I have tried changing the query around a bit with no avail.
This is the plugin code:
PHP Code:
$info_chatbox = $vbulletin->input->clean_gpc('r', 'info_chatbox', TYPE_STR);
// m?morise l'?tat de la chatbox si celui-ci ? chang?
if($vbulletin->GPC['info_chatbox'] != '' AND $vbulletin->GPC['info_chatbox'] != $vbulletin->userinfo['chatbox'])
{
$db->query_first("UPDATE " . TABLE_PREFIX . "user SET chatbox = " . intval($vbulletin->GPC['info_chatbox']) . " WHERE userid = " . $vbulletin->userinfo['userid']);
$vbulletin->userinfo['chatbox'] = $vbulletin->GPC['info_chatbox'];
}
// si chatbox ouverte
if (($vbulletin->userinfo['chatbox'] == 1 OR $vbulletin->userinfo['chatbox'] == 2) AND $vbulletin->options['chatbox_forumhome'] AND ($permissions['chatboxpermissions'] & $vbulletin->bf_ugp_chatboxpermissions['canusechatbox']))
{
$chatbox_refresh = $vbulletin->userinfo['chatbox'] == 1 ? 1 : 0;
eval('$chatbox .= "' . fetch_template('chatbox') . '";');
DEVDEBUG('Chatbox Template loaded');
} elseif ($vbulletin->userinfo['chatbox'] == 0){
require_once(DIR . '/includes/class_bbcode.php');
require_once(DIR . '/includes/functions_chatbox.php');
$result = $db->query_read("
SELECT userid, id, name, comment, date FROM " . TABLE_PREFIX . "chatbox
LEFT JOIN " . TABLE_PREFIX . "user ON (user.username=chatbox.name)
WHERE etat = 0 ORDER BY id DESC LIMIT $chatbox_perpage_reduite");
if(!$db->num_rows($result)){
eval('$chatbit = "' . fetch_template('chatbox_bit_vide') . '";');
DEVDEBUG('Chatbox Template vide loaded');
}else{
$compteur = 0;
while($get = $db->fetch_array($result)){
$colorirc = ($compteur++ % 2) ? "1" : "2";
$name = $get['name'];
$date = date('[d/m|H:i]', $get['date'] + $vbulletin->userinfo['timezoneoffset']);
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$comment = $parser->do_parse($get['comment']);
if(substr($comment, 0, 3) == '/me'){
$comment = substr($comment, 3);
eval('$chatbit .= "' . fetch_template('chatbox_bit_me') . '";');
}else{
eval('$chatbit .= "' . fetch_template('chatbox_bit') . '";');
}
}
}
eval('$chatbox .= "' . fetch_template('chatbox_fermee') . '";');
DEVDEBUG('Chatbox Template fermee loaded');
}
This exact same code works fine on another board.
I figured out the issue, elseif ($vbulletin->userinfo['chatbox'] == 0){ changed to elseif ($vbulletin->userinfo['chatbox'] == 1){.