XF 1.4 Get user id from username straight HTML

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?
 

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?
 

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.
 

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