MyBB Community Forums

Full Version: How to get user id
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have got a question. How to get id of user, who is looking at my page at the moment? And what will this function return if user will be logged out ? Smile

Sorry 4 my english.
it can be found on their link, just click their name you'll see a link with their user id.

like this one: http://community.mybboard.net/user-18986.html

18986 is the id of yours.
And if they're logged out they have a uid of 0.
But how to get it via function ?
Well, what are you trying to do with it??
I think Watt wants to find or reference the User ID of someone on his forums (I believe it would be {$user['uid']} - although I may be wrong) . I was actually wondering this myself, and I believe to find the user ID, it is different on every page. I hope this helps!

EDIT: Corrected the function - the fuction to find the user's ID is:
{$user['uid']}
If that's what he meant it'd probably be something more like {$mybb->user['uid']}
Well actually, it depends on what Watt is doing. In practically all cases, $mybb->user['uid'] will return the UID of the user logged in - but if he wants (for example) the author of a post, he won't be able to use that.