Create a Login / Logoff top bar on my website
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 8, 2019 (RSS)
By andreasml - March 8, 2019
Hi
I wonder how I can create this Login / Logoff top bar on my website as the one you use at yours.
Regards
Andreas Lazaris
By gkornbluth - March 8, 2019 - edited: March 8, 2019
Hi Andreas,
You'll need to use the Website Membership plugin https://www.interactivetools.com/plugins/website-membership/ to use functions like requiring members to log in to protected pages.
Once you've installed and activated the plugin, to require a login for protected pages you can use code similar to:
<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>
At the top of the page after the load viewer library call
And to insert log off code you can use something like the following where you want the link to appear:
<?php if ($CURRENT_USER) : ?><a class="special-link" href='?action=logoff'>WHEN YOU'RE DONE, CLICK HERE TO LOG OFF</a><?php endif ?>
There are examples of many uses for the Website Membership plugin in my CMSB Cookbook http://thecmsbcookbook.com/
Hope that helps,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php