• 0
Sign in to follow this  
Followers 0

Login/Logout button

Question

Posted · Report post

This is sort of a two part question: 1. I am looking for a plugin (would rather not write the CSS) to display a login button (or link) on my navigation bar ... and a logout link (if they are already logged in). I know, it's probably 5 lines of css but I guess I am a little lazy today and really don't want to reinvent the wheel. The Meta widget is close, except I just want the login/out 2. For the above - any CSS tips for PlatformPro to easily place this login button/link on the nav bar next to the search box? I am sure this has been discussed on these boards, I just can't seem to find it in a simple search. Thanks and Happy Holidays!

Share this post


Link to post
Share on other sites

8 answers to this question

  • 0

Posted · Report post

Cornell, I've looked and I cannot find any easy CSS that will alternate menu items between states. Specifically, I mean a login button when not logged in, and a logout when logged in. I understand your lack of desire to add CSS code, however, the alternative seems much more labor intensive: http://erisds.co.uk/wordpress/snippet-wordpress-3-0-menus-add-a-login-logout-link As for the answer to No. 2 on your list, the last menu item in your menu should be next to the search box. There are however, custom login/logout plugins that would apply in the sidebar. Those are intuitive so they would change based on the state, as well as adding a registration link.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

To clarify - I wasn't looking for code that would "alternate menu items between states" - though that would be an interesting approach - now that you mentioned it. I am already using a sidebar widget that does what I want, but the problem is that I don't use sidebars on many of my pages. I'd rather have one consistent "Welcome: Mr. User / Logout" or "Login/Register" link on the upper right corner. I think I can do it completely with CSS (without PHP) inside the custom code section. Working on it now. I'll report back and post the code if I ever get it to work. But this little piece of functionality might be nice to include in upcoming versions of Platform pro. Thanks

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I understood from [quote]"...a logout link (if they are already logged in)"[/quote] that you wanted it to be by state of login, but yes, it is a good way to do it. However, I do not know exactly how that could possibly be achieved with CSS unless it were coordinated with a function. CSS cannot determine states of login to my knowledge. However, if you need both, you could always create a login item in the main menu, and a drop down option for logout by creating a link back to your homepage, labeling it "Logout" and making it a child link under Login. At least that would be a temporary solution until you find a better one. I will alert the developers to your suggestion.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Yes, I was toying with combining css with some well documented wordpress php ... but stopped ... I decided that I was about to pretty much write a new plugin, and I am sure one already exists. Instead, I am going to tweak one of the plugins I found ... Thanks!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No problem.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

@cornell2 Add to style.css [code].icons .loginicon {background: url('../../icons/login.png') no-repeat 50% 0;} .icons .logout {background: url('../../icons/logout.png') no-repeat 50% 0;} .icons .goto_profile {background: url('../../icons/profile.png') no-repeat 50% 0;}[/code] Add to functions.php [code] add_action('pagelines_branding_icons_end', 'add_icons_to_branding');[/code] [code] function add_icons_to_branding(){ // This hook adds a icon to the header of your theme. The class referenced in the link can be seen in the style.css ?> display_name . " ?ยป";?>

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I'll try out the code you posted - but the site you gave as an example does not seem to show what I am looking for. Actually, I already coded a simpler solution (the php, at least) - it's just that I am still having trouble figuring out how to display it inside the navigation bar. here is the code that goes into functions.php [code]function my_login_status() { global $user_login; $siteurl = get_bloginfo('url'); $logout = get_bloginfo('url')."/wp-login.php?action=logout&redirect_to=".get_bloginfo('url')."&_wpnonce=5b2c309ac6"; $login = get_bloginfo('url')."/wp-login.php?redirect_to=".get_bloginfo('url')."%2Fblog%2F"; $useradmin = get_bloginfo('url')."/wp-admin/profile.php"; if (is_user_logged_in()) { $wpmem_login_status = '

Welcome: '.$user_login.' | logout

'; } else { $wpmem_login_status = '

You are not logged in | login

'; } return $wpmem_login_status; }[/code] and then at the end of header.php I put [code]
[/code] this works perfect for me, except it is underneath the navigation bar, not inside of it. you can see it at [url="http://metapreneurship.net/"]http://metapreneurship.net/[/url] [begin rant] And, with all due respect to whoever marked this as "answered" ... this is a pet peeve of many on these boards: perhaps we can leave it up to the person who actually asked the question to decide whether or not they got they answer they needed. Someone else summarily marking it as 'answered' not only blindsides the original questioner, it also discourages others (who might actually have something helpful to say - since the thread appears closed). It's simply not a good practice. [end rant]

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No problem, as well... i'm not encouraged either.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0