Support » Fixing WordPress » How to check if user is logged in?

Viewing 3 replies - 1 through 3 (of 3 total)
  • All problems solved.
    I made a simple function.
    Just use it wherever you like.

    function userlogged(){
    global $user_ID;
    get_currentuserinfo();
    if ( $user_ID==” ){
    return false; //user not logged in
    } else {
    return true; //user logged in
    }
    }

    Use this function like:

    if (userlogged()){
    //logged true, proceed
    } else{
    //logged false, do what ever, maybe nothing?
    }

    it’s not working with me

    did you find this?

    http://wordpress.org/support/topic/46315

    if (!$user_ID) {
    // this will show when someone is not logged in
    }

    or you can use:
    if ($user_ID) {
    // this will show when someone is logged in
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to check if user is logged in?’ is closed to new replies.