Is there any way to check if a user with a certain id or name is online in WordPress?
Leave a Reply
You must be logged in to post a comment.
Is there any way to check if a user with a certain id or name is online in WordPress?
You must be logged in to post a comment.
I think the function you want is
is_user_logged_in
. Maybe tryTo set the current user by id, and then check if they are logged in using
http://codex.wordpress.org/Function_Reference/wp_set_current_user
http://codex.wordpress.org/Function_Reference/is_user_logged_in
jkeesh has a good solution, but that may not offer live information.
is_user_logged_in()
is a conditional statement for performing actions.It’s helpful if you want to do this for example:
When logged in, show
smiley.jpg
When logged out, don’t show
smiley.jpg
If you are simply trying to do one of those features which forums have that show “x number of users online” and list their usernames, I don’t believe this conditional statement can do that. That would either require some custom code or another plugin.