I have make some slight modification to chatvbh.php so that when the user is not login or registered he will be taken to registration or signup page and will automatically redirect the user back to the chat.
PHP Code:
<?
require('./global.php');
if ($bbuserid == 0)
{
$thispage=urlencode("$PHP_SELF");
header("Location:[url]http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=[/url]".$thispage);
}
$DB_site->query("UPDATE user SET inchat='1' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET lastchatactivity=$ourtimenow WHERE userid='$bbuserinfo[userid]'");
if ($bbusername == "" || (isset($bbusername))==0)
{
$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$bbuserid");
$username=$getusername[username];
$bbusername = $username;
}
else
{
$username = $bbusername;
}
eval("echo standarderror(\$bbtitle,\"".gettemplate("vbh_chat")."\");");
?>