Hack Forums
[TuT] MyBB Forum Mods Only See Reported Posts From Their Section - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: [TuT] MyBB Forum Mods Only See Reported Posts From Their Section (/showthread.php?tid=1668889)



[TuT] MyBB Forum Mods Only See Reported Posts From Their Section - Xerotic - Aug 30, 2011

Alright, I will show you a quick fix so that Forum Moderators see ONLY their forum reports.

Part 1
Only show our forum reports.

First change you will want is in modcp.php at root.

Search for the following, it should be around line 104.
PHP Code

<?php 
if($mybb->input['action'] == "reports") 

Once you are there, scroll down until you see the following:

PHP Code

<?php 
$trow 
= alt_trow();
        if(
is_moderator($report['fid']))
        {
            
$trow = 'trow_shaded';
        } 

This is what we are altering. We will be adding an 'else' statement after this. Now the above should look like:

PHP Code

<?php 
$trow 
= alt_trow();
        if(
is_moderator($report['fid']))
        {
            
$trow = 'trow_shaded';
        }
        else {
                continue;
        } 

--

Part 2
Adjust global unreadreports message.

Now we will need to edit global.php at root. We need to only display how many reports are in your section.

So open up global.php and look for the following:

PHP Code

<?php 
$unreadreports 
= ''; 

There should only be one instance.

Alright, now that you are at the mark, we need to change the following:

PHP Code

<?php 
$unreadreports 
= '';
// This user is a moderator, super moderator or administrator
if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'])
{
    
// Read the reported posts cache
    
$reported = $cache->read("reportedposts");

    
// 0 or more reported posts currently exist
    
if($reported['unread'] > 0)
    {
        if(
$reported['unread'] == 1)
        {
            
$lang->unread_reports = $lang->unread_report;
        }
        else
        {
            
$lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']);
        }
        eval(
"\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
    }
} 

to..

PHP Code

<?php 
$unreadreports 
= '';
// This user is a moderator, super moderator or administrator
if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'])
{
    if(
$mybb->usergroup['cancp'] || $mybb->usergroup['issupermod'])
    {
         
// Read the reported posts cache
        
$reported = $cache->read("reportedposts");

        
// 0 or more reported posts currently exist
        
if($reported['unread'] > 0)
        {
            if(
$reported['unread'] == 1)
            {
                
$lang->unread_reports = $lang->unread_report;
            }
            else
            {
                
$lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']);
            }
            eval(
"\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
        }
    }
    else {
        
$query = $db->simple_select("reportedposts", "reportstatus,fid", "reportstatus='0'");
        
        
$reportsleft = 0;
        
        while(
$report = $db->fetch_array($query))
        {
            if(
is_moderator($report['fid']))
            {
                
$reportsleft +=1;
            }
        }
        
        
// 0 or more reported posts currently exist
        
if($reportsleft > 0)
        {
            if(
$reportsleft == 1)
            {
                
$lang->unread_reports = $lang->unread_report;
            }
            else
            {
                
$lang->unread_reports = $lang->sprintf($lang->unread_reports, $reportsleft);
            }
            eval(
"\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
        }
    }
} 

The difference with this, is that it checks if the user is an Admin or Super Moderator first, and handle the reports notice as normal.

However, if the person is a normal mod, it will continue to the next part of the script, the 'else' statement.

The else statement grabs the number of reports from the reportedposts table (using simple_select only taking the columns 'reportstatus' and 'fid') and checks to see if the user is the moderator of that forum area. It then displays the results as normal.

--

Well guys, that is pretty much it, please leave some feedback and criticism 👍

-

Official MyBB Thread:
http://community.mybb.com/thread-102786.html


* - Gone-KaPPaH - Aug 30, 2011

Thanks for this man i just opened my forum and needed this :D


* - Xerotic - Aug 30, 2011

(Aug 30, 2011 03:09 AM)KaPPaH Wrote:  Thanks for this man i just opened my forum and needed this :D

Yeah, I needed it as well, so figured do it myself. I posted a thread at mybb.com asking for more moderation permission options in upcoming versions:
http://community.mybb.com/thread-102779.html




* - Gone-KaPPaH - Aug 30, 2011

(Aug 30, 2011 03:10 AM)xerotic Wrote:  Yeah, I needed it as well, so figured do it myself. I posted a thread at mybb.com asking for more moderation permission options in upcoming versions:
http://community.mybb.com/thread-102779.html

Yeah ill admit mods need new things they cant do as much as you would think.


* - Xerotic - Aug 30, 2011

(Aug 30, 2011 03:12 AM)KaPPaH Wrote:  Yeah ill admit mods need new things they cant do as much as you would think.

I also want to limit some things. For example, I may want mods to be able to handle reported posts in their section, but I may not want them to have IP access. It is an evil. Either they get everything, or nothing, it seems.


* - Gone-KaPPaH - Aug 30, 2011

(Aug 30, 2011 03:15 AM)xerotic Wrote:  I also want to limit some things. For example, I may want mods to be able to handle reported posts in their section, but I may not want them to have IP access. It is an evil. Either they get everything, or nothing, it seems.

It does seem that way but things may change.


* - Xerotic - Aug 30, 2011

(Aug 30, 2011 03:17 AM)KaPPaH Wrote:  It does seem that way but things may change.

Hopefully. There are plugins for it.. but they do not offer full customization.