Not Solved usergroup problem
#1
Not Solved
hello,

i have this code:

function board_messages()
{
    global $db, $templates, $board_messages, $current_page;
        $board_messages = '';
        $query = $db->simple_select('board_messages', '*', "enabled='1'");
        while($message = $db->fetch_array($query))
        {
            if($message['global'] != 0 || $current_page == 'index.php')
            {
                if(!$message['class'])
                {
                    $message['class'] = 'board_message';
                }

                $board_messages .= '<div class="'.$message['class'].'">'.$message['message'].'</div>';
            }
        }
    }

we can make, the guest show the message and the another groups (2,3,4,6) not?

thank you very much for answer.
Reply
#2
Not Solved
if(!in_array($mybb->user['usergroup'],[2,3,4,6])) {
//nope
}
else {
message here
}
Reply
#3
Not Solved
function board_messages()
{
    global $db, $templates, $board_messages, $current_page, $mybb;
    if(!in_array($mybb->user['usergroup'],[2,3,4,6])) {
       $board_messages = '';
       }
else {
        $query = $db->simple_select('board_messages', '*', "enabled='1'");
        while($message = $db->fetch_array($query))
        {
         if($message['global'] != 0 || $current_page == 'index.php')
            {
                if(!$message['class'])
                {
                    $message['class'] = 'board_message';
                }

                $board_messages .= '<div class="'.$message['class'].'">'.$message['message'].'</div>';
            }
        }
    }
}

is this correct?
Reply
#4
Not Solved
i Think the most easy way to do this is adding code inside template

header_wellcome_member_guest

Or something like that, but that is only seeing by guests.

No plugins or other things, but if you add this to use like a plugin that's ok.

i really prefer to use this code.

if(!$mybb->user['uid'] || $mybb->user['usergroup'] == 1){
do something
}
else{
// do nothing or only not use else...
}
That´s an easy code where guest group get user id 1.
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
#5
Not Solved
function board_messages()
{
    global $db, $templates, $board_messages, $current_page, $mybb;
    if(!$mybb->user['uid'] || $mybb->user['usergroup'] == 1){
       $board_messages = '';
       $query = $db->simple_select('board_messages', '*', "enabled='1'");
        while($message = $db->fetch_array($query))
        {
         if($message['global'] != 0 || $current_page == 'index.php')
            {
                if(!$message['class'])
                {
                    $message['class'] = 'board_message';
                }

                $board_messages .= '<div class="'.$message['class'].'">'.$message['message'].'</div>';
            }
        }
    }
}

thank you very much...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)