As long as the result is "True" (the user is a guest) then you can do it anyway you like. There's more than one way to skin a cat...

Forgive the long winded way of doing it, I am a complete PHP novice, I found a way to do what I wanted and stuck with it.
It all came about from a forum I visit where I wasn't to keen on the ability for all and sundry to see the registered users (it was a security forum after all). So I had a poke around and came up with this fix, I tested running on my PC, informed the forum admin that it works and he's still yet to implement. Perhaps he doesn't think it matters that much...he's hoping it'll apear in a future release so that he doesn't have to keep patching after an update.

There's always a better way and if I keep reading and posting on here, you never know I may learn something...

Thanks for the input.

SWF

j2k4b wrote:

I logged out of my board and cleared cookies and stuff. The userlist link isn't on my board but if I type in the domain (ie: http://www.domain.com/punbb/userlist.php) then the userlist will come up. I want it disabled for view unless you are logged in.

This is something I've been doing for a while, a manual hack to the functions.php and userlist.php which stops the user list menu item being shown or the userlist.php page being opened when manualy entered in the address bar.

The code looks like this.....

in functions.php to prevent the menu item apearing....

//
// Generate the "navigator" that appears at the top of every page
//
function generate_navlinks()
{
    global $pun_config, $lang_common, $pun_user;

    // Index and Userlist should always be displayed
    $links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';
   
    // Confirm the User has authenticated defore displaying menu option.
    if ($pun_user['is_guest'] == '0')

    $links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';

    if ($pun_config['o_rules'] == '1')
        $links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';
.
.
.
etc.

And then in the userlist.php....to prevent a typed url being used....


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

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

// Verify the user has authenticated and display Permission Error if not.
if ($pun_user['is_guest'] == '1')
    message($lang_common['No permission']);
else
{

// Load the userlist.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/userlist.php';

// Load the search.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/search.php';
.
.
.
etc.

<?php
}
require PUN_ROOT.'footer.php'



If you want to enter the code i'd suggest searching for some of the surrounding text to get you to the right place first.
It works for me and if anyone has the time to make it into a full blown mod then got for it....