In login.php I added the following cookies:
replace:
Code:
if ($_REQUEST['cookieuser'])
{
vbsetcookie('userid', $bbuserinfo['userid']);
vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d'));
}
with:
Code:
if ($_REQUEST['cookieuser'])
{
vbsetcookie('userid', $bbuserinfo['userid']);
vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d'));
vbsetcookie('username', $bbuserinfo['username']);
}
and replace:
Code:
{
// we have a cookie from a user and we're logging in as
// a different user and we're not going to store a new cookie,
// so let's unset the old one
vbsetcookie('userid', '');
vbsetcookie('password', '');
}
with:
Code:
{
// we have a cookie from a user and we're logging in as
// a different user and we're not going to store a new cookie,
// so let's unset the old one
vbsetcookie('userid', '');
vbsetcookie('password', '');
vbsetcookie('username', '');
}
The users will need to log out and log back in to set this new cookie however.
So far it works very well, the cookie $bbusername is available all over my domain and I can force people to use there forum name. Also, to check if they are registerd for the forums already, anywhere on the site without including global.php, just use a simple if: (your vB cookies must be set to the whole domain for this to work)
Code:
if (isset($bbuserid)) {
arguments
} else {
echo "please register at the forums before posting here or accessing this part of the site etc";
}
By the way, if you are interested in see where / how this works, the site I am using it on is
www.wcreplays.com