Website Membership LogOUT

By CommonSenseDesign - November 1, 2020

Hi, there. If someone has logged in to members-only section of a site via the Website Membership plugin, is there a way for them to log out?

By Dave - November 6, 2020

Hi CommonSenseDesign, 

Yes there is.  Here's some info from the readme.txt in the plugin folder on how to create logoff links: 

SHOWING DIFFERENT CONTENT BASED ON USER
-------------------------------------------------------------------------------
Follow these steps to display different content based on login status:

- Make sure the viewer_functions.php are loaded in the header of the page and
that the path is correct for your server.
Example: <?php require_once "cmsb/lib/viewer_functions.php"; ?>

- Use this code to display content for logged in users only:
<?php if ($CURRENT_USER): ?>
Only logged in users will be able to see this.
<?php endif ?>

- Use this code to display content for users who aren't logged in:
<?php if (!$CURRENT_USER): ?>
Only logged who are _not_ logged in will see this:
<?php endif ?>

- This code would show either the users name or a login message in the header:
<?php if ($CURRENT_USER): ?>
Welcome, <?php echo $CURRENT_USER['username'] ?>!
<a href="<?php echo $GLOBALS['WEBSITE_LOGIN_PROFILE_URL'] ?>">Edit Profile</a> |
<a href="?action=logoff">Logoff</a><br/>
<?php else: ?>
<a href="<?php echo $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] ?>">Login</a>
<?php endif ?>

Hope that helps! 

Dave Edis - Senior Developer
interactivetools.com