Topic: Problems Integrating

I have added the includes and I am able to access other functions within common.php, but for some reason I cannot access the $pun_user array.

Here is my code

$punbb_path = './forums/';

define('PUN_ROOT', "$punbb_path");
require PUN_ROOT.'include/common.php';

define('PUN_TURN_OFF_MAINT', 1); // if forums go down the site will not
define('PUN_QUIET_VISIT', 0); // update last visit when outside of the forums

function showloggedin(){
    if ($pun_user['id'] > 1){
        echo '<p class="loginbox">You are currently logged in as <strong>' . $pun_user['username'] . '.</strong>    > <a href="' . $_SERVER['PHP_SELF'] . '?p=logout">Logout</a></p>';
    }else{
        echo '<p class="loginbox">You are not currently logged in.  Please <a href="' . $_SERVER['PHP_SELF'] . '?p=login">login</a> or <a href="' . $_SERVER['PHP_SELF'] . '?p=register">register</a>.</p>';
    }
}

I used the $pun_user['id'] to test if the user was logged in, but I am sure there is probably a better way, so that is the second part of my question.  I have tried simply echoing the $pun_user['username'] with no luck.  I am sure I am logged into the forums.

Any help is much appreciated.

Re: Problems Integrating

When using in a function you have to make the variable global wink

And checking for loggedin: $pun_user['is_guest']

Re: Problems Integrating

When I echo $pun_user['is_guest'] I get a 3
What does that mean?

Re: Problems Integrating

nathank wrote:

When I echo $pun_user['is_guest'] I get a 3
What does that mean?

That's odd...

Re: Problems Integrating

I am assuming I need to add something to this effect?

define('PUN_USER', $pun_user['username']);

Then use that within my functions.  Which works great.  However when I try to add something like

define('PUN_GUEST', $pun_user['is_guest']);

I just get a 3

Re: Problems Integrating

Sweet, I got it working.  I changed my variable name and it worked.