Forums

A member dependent login button (4 posts)

  1. taylorishere
    Member
    Posted 2 years ago #

    Is there a way to add a button to a custom menu that displays "login" when a user is not logged in, and "log out" when a user is logged in?

  2. There's a widget that does that (called Meta). What kind of menu are you talking about?

  3. taylorishere
    Member
    Posted 2 years ago #

    I think I figured it out, with this code:

    function loginlogout_button() {
    
    if ( is_user_logged_in() ) {?>
        <div id="loginbutton"><a>" title="Logout">Logout</a></div><?php;
    } else {?>
        <div id="loginbutton"><a href="[USER DEFINED URL]" title="Login">Login</a></div><?php;
    };
  4. laki_cetatti
    Member
    Posted 1 year ago #

    Hi,

    Can this insert to a manually insert button??????? Ex. If an user login button image should be "pay now" and if not button image should be "register".

    Can this be done with above code?????????

Topic Closed

This topic has been closed to new replies.

About this Topic