• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 User ID in Custom User Fields

Cooper

Active member
#1
I'm trying to hyperlink a custom user field, and adding the HTML hyperlink, but I'd like to add the User ID in as a parameter, eg

HTML:
<a href="page.php?userid={something}">{$value}</a>
Any ideas how I get the user_id in here?

Thanks
Andy
 
F

Floris

Guest
#2
Of the user visiting the page, or of the data of the user (eh, profile, or eh post)?
For the first one, tried {$visitor.user_id} ?
 

Cooper

Active member
#6
Are you working in the templates? Where exactly are you inserting this code?
Admin CP > Users > Custom User Field > General Options > Value Display HTML

try {$post.user_id} or {$message.user_id}
Unfortunately these didn't work. I suspect I may have to do a template edit to make this work - ideally even on the user info beside a post. Thoughts on how to capture my custom field (called "Drives") and then assign the user_id to it would be very helpful.
 

Jake Bunce

XenForo moderator
Staff member
#7

Cooper

Active member
#8
How do I manipulate a custom user field in a template if it is dynamically generated from the "Custom User Field" system?
 

Jake Bunce

XenForo moderator
Staff member
#9
You can use those variables in the HTML. For example:

Code:
<a href="page.php?userid={$user.user_id}">{$user.customFields.field_id}</a>