There was fiew things in
inc / plugins / adv_sidebox / modules / private_messages / adv_sidebox_module.php
Line 82, did not work.
For eg. when user is logedin and administrator disable pm's then user will
get message that he 'should register to view' (while he is registered and logedin) ect ect.
Line 107 to 110 caused strange outcome where if forum is installed in folder and not root,
then link within this message for some unknown reason is invalid and lead to non exsisting
page. ( if it would be root/foldername/something then output was root/something
and fodlername just magically vanished)
There was also fiew other things, which made me decide to update this module.
Line 107 to 110 removed and its functionality has moved to line 82 and below)
Line 82 changed and new lines added to properly handle possible situations,
Line 100 to 103, shortened into one line with same functionality.
Language file changes :
In PM's section - removed arrays, standarised format, messages added.
All pm box messages are 100% customisable within language file pm's block
(including text which appear as links, "login", "register", "control panel")
Functionality :
When user is loged in, he will receive standard output from pm's module.
When user is not logedin he will receive message :
'Please login or register to use this functionality.' (where "login" and "register" are links)
When user is logedin but disabled pm's in usercp he will receive message :
'You have disabled this functionality in control panel.' (where "control panel" is link)
When user is loged in but group cant use pm's or its disabled globaly
he will receive message :
'You dont have privileges to access this functionality, or it has been disabled by administrator. You may contact administrator for assistance.'
Code :
inc / plugins / adv_sidebox / modules / private_messages / adv_sidebox_module.php
Lines 82 to 110 has been removed and replaced with this :
if(!$mybb->user['uid'])
{
// user is guest - output "please login or register" block with login and register links.
$private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_no_messages."</td></tr>","<a href='".$mybb->settings['bburl']."/member.php?action=login'>".$lang->adv_sidebox_pms_login."</a>","<a href='".$mybb->settings['bburl']."/member.php?action=register'>".$lang->adv_sidebox_pms_register."</a>");
}
elseif (!$mybb->user['receivepms'])
{
// user dont want pm's - output "you have disabled pms in control panel" block with link to usercp.
$private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_user_disabled_pms."</td></tr>","<a href='".$mybb->settings['bburl']."/usercp.php?action=options'>".$lang->adv_sidebox_pms_usercp."</a>");
}
elseif (!$mybb->usergroup['canusepms'] || !$mybb->settings['enablepms'])
{
// admin has disabled pm's - output "no privileges or disabled by admin" block.
$private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_disabled_by_admin."</td></tr>","<a href='".$mybb->settings['bburl']."/usercp.php?action=options'>".$lang->adv_sidebox_pms_usercp."</a>");
}
else
{
switch($db->type)
{
case "sqlite":
case "pgsql":
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='" . $mybb->user['uid'] . "'");
$messages['pms_total'] = $db->fetch_field($query, "pms_total");
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='" . $mybb->user['uid'] . "' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
$messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
break;
default:
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='" . $mybb->user['uid'] . "'");
$messages = $db->fetch_array($query);
}
// the SUM() thing returns "" instead of 0 (make it int anyway)
$messages['pms_unread'] *= 1;
$lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_unread']);
eval("\$private_messages = \"" . $templates->get("adv_sidebox_pms") . "\";");
}
inc / languages / english / adv_sidebox.lang.php
Line 62 to 63 removed and replaced with this :
// pm's
$l['adv_sidebox_pms_no_messages'] = 'Please {1} or {2} to use this functionality.';
$l['adv_sidebox_pms_login'] = 'login';
$l['adv_sidebox_pms_register'] = 'register';
$l['adv_sidebox_pms_user_disabled_pms'] = 'You have disabled this functionality in {1}.';
$l['adv_sidebox_pms_usercp'] = 'control panel';
$l['adv_sidebox_pms_disabled_by_admin'] = 'You dont have privileges to access this functionality, or it has been disabled by administrator. You may contact administrator for assistance.';