Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: MrLeN on December 16, 2012, 04:01:12 AM

Title: login PHP
Post by: MrLeN on December 16, 2012, 04:01:12 AM
I am building a website using stuff from ssi_examples.php

There's one that says:


<?php ssi_logout(); ?>


but I want to make:


if (isset(MemberLoggedIn)) {
  ssi_logout();
}
else {
  echo '<a href="index.php?action=login">Login</a>';
}



What can I put in place of MemberLoggedIn?

Or, if that is no good -- how else can I replace the logout link with a login link?
Title: Re: login PHP
Post by: Colin on December 16, 2012, 04:16:38 AM
!$context['user']['is_guest']


and remember to define context as a global variable.
Title: Re: login PHP
Post by: MrLeN on December 16, 2012, 04:38:25 AM
I don't know what a global variable is or how to "define" it  :o
Title: Re: login PHP
Post by: emanuele on December 16, 2012, 04:46:43 AM
<?php
global $user_info;

if (
$user_info['is_guest'])
    
ssi_login();
else
    
ssi_logout();
Title: Re: login PHP
Post by: MrLeN on December 16, 2012, 05:00:01 AM
Thanks :)