• Hi,
    I would like to add a login form to my sidebar, similar in function to the login form on wordpress.com.
    When the user logs in, the form disappears and a user identity message is displayed. I know how to put the register, login / logout links on the page, and I can get a login form on the page, but I cannot figure out how to make it go away once logged in.
    I am using this post to display the user identity message.
    I know it should go into a if, else or something like that, but I cannot figure out the check for login process.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Taking skippy’s code from the thread linked to, you can do:

    global $user_identity;
    get_currentuserdata();
    if ($user_identity) {
    echo "Hi $user_identity!";
    } else {
    wp_loginout();
    }
    ?>

    Add to our replace wp_loginout(); with whatever you need to display when one is not logged in.

    Thread Starter Aaron

    (@ergate)

    is that function in 2.0.
    I am getting this error

    Fatal error: Call to undefined function: get_currentuserdata() in /home/…/wp-content/themes/complaint_main/sidebar.php on line 16

    Sorry, copied over skippy’s block without reading through it. The function should be get_currentuserinfo().

    Thread Starter Aaron

    (@ergate)

    Brilliant,
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘login form like wp.com’ is closed to new replies.