loginlink() - logOUTlink()

General questions about CMSimple
Post Reply
wdburgdorf
Posts: 2
Joined: Wed Sep 04, 2013 2:56 pm

loginlink() - logOUTlink()

Post by wdburgdorf » Wed Sep 04, 2013 3:02 pm

Hi,

loginlink() shows a link to the login page when not logged in. The link disappears once logged in. Is there a way to display a log out link instead of nothing?

Thanks!

Regards, Ralf.

wdburgdorf
Posts: 2
Joined: Wed Sep 04, 2013 2:56 pm

Re: loginlink() - logOUTlink()

Post by wdburgdorf » Wed Sep 04, 2013 3:11 pm

Fixed it myself, but would be glad to know if there's a better way.

My way:

Added function to cms.php:

Code: Select all

function logoutlink() {
    return '<a href="?&logout">Logout</a>';
}
Edited template.htm:

Code: Select all

<?php echo loginlink();echo logoutlink();?>

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: loginlink() - logOUTlink()

Post by cmb » Wed Sep 04, 2013 3:16 pm

Hi Ralf,
wdburgdorf wrote:Fixed it myself, but would be glad to know if there's a better way.
IMO it's fine as it is. If you want to hide the logout link when the user is not logged in, you may change the function:

Code: Select all

function logoutlink() {
    global $adm;

    if ($adm) {
        return '<a href="?&logout">Logout</a>';
    } else {
       return '';
    }
} 
If you're using CMSimple_XH >= 1.5.4 use XH_ADM instead of $adm, and remove the global "declaration".

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply