2010-12-12, 04:25 PM
Basically, I'm writing proper user permissions into my mystatus plugin and am having a problem when it comes to displaying statuses in posts. I have a permission that allows the blocking of using statuses at all on a usergroup basis. That's fine and it works everywhere else apart from in the postbit. What I want to do is hide the contents of $post['mystatus'] should the user's usergroup be "banned" from using statuses.
Here's my current code for this:
The editing part works absolutely perfect, but the current status displays no matter what. However, "banning" a group from statuses whilst they have edit permissions hides the edit link... weird.
Anybody got any ideas what I'm doing wrong? it's probably something really simple, but I cant see it atm haha
Here's my current code for this:
$canusemystatus = $db->simple_select('usergroups', 'canusemystatus', 'gid = ' . $post['usergroup']);
$canusemystatus = $db->fetch_field($canusemystatus, 'canusemystatus');
if ($mybb->settings['mystatusenable'] == 1 && $canusemystatus == 1) {
//grabbing the current status
$currentstatus = $db->query("SELECT `mystatus` FROM `".TABLE_PREFIX."users` WHERE `uid` = ".$post['uid'].";");
$currentstatus = $db->fetch_field($currentstatus, "mystatus");
$post['mystatus'] = '<span class="smalltext">'.$currentstatus.'</span>';
//status editing
if ($mybb->user['uid'] == $post['uid'] || $mybb->usergroup['canmodstatuses'] != 0) {
$post['mystatus'] = '<span class="smalltext post-mystatus-'.$post['pid'].'">'.$currentstatus.' <a href="#" onclick="MyBB.popupWindow(\''.$mybb->settings['bburl'].'/process-mystatus.php?action=postbitedit&updateuid='.$post['uid'].'\', \'MyStatus Update\', 350, 115);">Edit</a></span>';
}
return $post;
}
The editing part works absolutely perfect, but the current status displays no matter what. However, "banning" a group from statuses whilst they have edit permissions hides the edit link... weird.
Anybody got any ideas what I'm doing wrong? it's probably something really simple, but I cant see it atm haha