• 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


Active member
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

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



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} ?


Active member
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


Active member
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
You can use those variables in the HTML. For example:

Rich (BB code):
<a href="page.php?userid={$user.user_id}">{$user.customFields.field_id}</a>