turn username into a profile link
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #12
RE: turn username into a profile link
Without custom code modifications, this is really pushing what can be done with XThreads, but I suppose this could be possible, with a bunch of caveats.

You can set the Display Item Format to something like:

HTML Code
1
2
3
4
5
6
<setvar user>get_user_by_username({VALUE})</setvar>
<if $tplvars['user']['uid'] then>
 <?=build_profile_link({VALUE}, $tplvars['user']['uid'])?>
<else>
 {VALUE}
</if>

Caveats:
- get_user_by_username isn't a "safe" function, but if you have the PHP in Templates plugin, it should be allowed.  Alternatively, you can whitelist it by appending it to inc/xthreads/phptpl_allowed_funcs.txt
- it can run a query for every single user specified, which can place more load on the server

In theory, you could also do something similar using the Input Formatter to validate usernames, and store them as user IDs, but you still have the above caveats.


My Blog
(This post was last modified: 04-02-2017 09:10 PM by ZiNgA BuRgA.)
04-02-2017 09:09 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
turn username into a profile link - foxxie - 02-08-2017, 07:57 AM
RE: turn username into a profile link - ZiNgA BuRgA - 04-02-2017 09:09 PM

 Standard Tools
Forum Jump: