1. 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

Discussion in 'XenForo Questions and Support' started by Cooper, Apr 1, 2012.

  1. Cooper

    Cooper 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

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

    Thanks
    Andy
     
  2. Floris

    Floris Guest

    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} ?
     
  3. Cooper

    Cooper Active Member

    The user id of the post/profile NOT the logged in user :)
     
  4. Floris

    Floris Guest

    try {$post.user_id} or {$message.user_id}
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Are you working in the templates? Where exactly are you inserting this code?
     
  6. Cooper

    Cooper Active Member

    Admin CP > Users > Custom User Field > General Options > Value Display HTML

    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.
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  8. Cooper

    Cooper Active Member

    How do I manipulate a custom user field in a template if it is dynamically generated from the "Custom User Field" system?
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can use those variables in the HTML. For example:

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

Share This Page