Topic: If pun_user is authenticated AND is in usergroup N

Question: I would like to write an external small function that says: ?if called by someone that is an authenticated PunBB user, and that user belong to group A, B or C then ok, if not die?.

I was going through the Pun source code, but I can't find the appropriate files and functions. Does someone have an example in Pun's code where something like that might be done in the simplest way possible?

Re: If pun_user is authenticated AND is in usergroup N

if (!$pun_user['is_guest'] && ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_id'] == PUN_MOD))
    return true;
else
    return false;

3 (edited by Jérémie 2007-06-12 03:51)

Re: If pun_user is authenticated AND is in usergroup N

Thanks Smartys smile

Including common.php and defining pun constant should suffice for everything required on Pun's end?

Edit: it seems so. Thanks again.

4

Re: If pun_user is authenticated AND is in usergroup N

if ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_id'] == PUN_MOD)
    return true;
else
    return false;

Should be enough, you do not need to test if the user is a guest. It seems redundant if you check his group or am I wrong ?

Re: If pun_user is authenticated AND is in usergroup N

True wink