Create a sidebar login status and logout link

In some layouts, you may wish to not use the WP-Members sidebar widget for logging users in, but you may still want to display a user’s login status (when logged in) and provide a logout link.  Here is how you can do that with a plain text widget.

  • Add a plain text widget to your sidebar
  • Add the following shortcodes to the text widget:

    [wpmem_logged_in]
    You are logged in as [wpmem_field user_login].
    [wpmem_logout]
    [/wpmem_logged_in]

  • You’ll need to verify that your sidebar can display shortcodes for this to work.  If the logout link does not show when you are in a logged in state, you will need to enable shortcodes for the sidebar:

    [php]add_filter(‘widget_text’, ‘do_shortcode’);[/php]

    (See “Adding Shortcodes to Other Locations” for more information.)

The resulting widget should only display when the user is logged in and will display the user’s username and a link to logout.  Customize as needed…