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

XF 1.4 Get user id from username straight HTML

Discussion in 'XenForo Questions and Support' started by michaelwm, Dec 24, 2014.

  1. michaelwm

    michaelwm Member

    is there anyway for me to get the user id of a user straight from their username? For example, convert my username (michaelwm) to my user # (1). I want to do this specifically to get the user avatars, as their url's use the user ids. If this is possible, can I do in vanilla html, or do I require php/js?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    It would require php to pull the user id from the user name.

    What are you trying to do exactly?
  3. michaelwm

    michaelwm Member

    My site is pulling RSS news information from one of our public boards to display on the splash page (an announcements box of sorts). I would like to post an image of the avatar of the user who wrote the news thread. The RSS feed includes the name of the user who wrote the thread, but not their ID. Xenforo avatar links have one thing different between them, that being the user ID. I was thinking that if I could just get their user ID and sub it into the image url, I could display the users avatar.

    Is there a simpler way? Or should I use this idea?

    Hope that clears things up.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    If you are thinking of using xen:avatar then it requires certain data in the form of a $param.
    Just supplying the user ID won't work.
    It would need custom development to do it properly.

Share This Page