WordPress.org

Ready to get started?Download WordPress

Forums

How to check if user is logged in? (4 posts)

  1. Seikilos
    Member
    Posted 8 years ago #

    Hello,
    im serarching for a simple way to check if the user ist fully logged in or not. Is there a function for it?

  2. Seikilos
    Member
    Posted 8 years ago #

    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?
    }

  3. nradeef
    Member
    Posted 8 years ago #

    it's not working with me

  4. nearlythere
    Member
    Posted 8 years ago #

    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
    }

Topic Closed

This topic has been closed to new replies.

About this Topic