MyBB Community Forums

Full Version: Not able to understand this code.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What does this mean ? I'm not getting it..What is "0" group ?? Admin ??

// if user a guest, answered to Posting, or moderators are not the text indicated
if ( ($mybb->user[uid] != "0" && $selfposted > "0") || $mybb->usergroup[cancp] == "1") {
    $search="/\[hide](.*)\[\/hide\]/siU";
    $replace="<div class='hidetags_header'><b>Un-Hidden Text:</b></div><div class='hidetags_body' style='display: block;'>\\1</div>";
    $message = preg_replace($search, $replace, $message);
    $message = str_replace("\'", "'", $message);
    $message = $message;
} else {
You mean this bit??

$mybb->user[uid] != "0"

Guests have a uid of 0, so if the uid of the current user isn't 0, they're a logged in user.
Why would the admin usergroup have a gid of 0?? If you look in the admin panel, they have a gid of 4. As Matt said, Guests have no uid and the PHP conditional checks to see if a user doesn't have the uid 0.