Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: rsw686 on May 04, 2008, 03:31:13 PM

Title: [SMF 2b3] Moderation Center - Reported Posts
Post by: rsw686 on May 04, 2008, 03:31:13 PM
When assigning a member group permissions to "Access the moderation center" the "Reported Posts" menu item is still shown even if this member group does not have permission to "Moderate forum members".

The result is when clicking the "Reported Posts" menu item you receive a page stating "You are not allowed to moderate this forum.".
Title: Re: [SMF 2b3] Moderation Center - Reported Posts
Post by: rsw686 on May 04, 2008, 03:37:31 PM
There is actually more to this bug than I thought. The "Reported Posts" menu item should only be shown if either "Moderate forum members" or "Moderate board" is selected for the permissions.

Also the "Moderation Log" menu item should only be shown if "Moderate board" permissions are selected. If that permission is not selected the "Moderation Log" shows no entires, which could be misleading. It should show the error message "You are not allowed to moderate this forum.".

EDIT:

To add to this even more the "Moderation Log" will only show some of the entries with "Moderate board" permissions checked. I have to check "Moderate forum members" to see the entire log. This doesn't make sense as just having "Moderate forum members" checked doesn't show me any entries in the "Moderation Log"

I know the Moderation Center is new with SMF 2 so I expect it to have some bugs. Although it seems to have quite a number of them.
Title: Re: [SMF 2b3] Moderation Center - Reported Posts
Post by: SleePy on May 04, 2008, 10:03:32 PM
This might be fixed.

Open your ModerationCenter.php source file
Select everything from:
    // Don't run this twice... and don't conflict with the admin bar.

to
    // I don't know where we're going - I don't know where we've been...

That section sets up the menu and what links they should see
Replace it with:


    // Don't run this twice... and don't conflict with the admin bar.
    if (isset($context['admin_area']))
        return;

    // Everyone using this area must be allowed here!
    if ($user_info['mod_cache']['gq'] == '0=1' && $user_info['mod_cache']['bq'] == '0=1' && !allowedTo('manage_membergroups'))
        isAllowedTo('access_mod_center');

    // We're gonna want a menu of some kind.
    require_once($sourcedir .'/Subs-Menu.php');

    // Load the language, and the template.
    loadLanguage('ModerationCenter');
    loadTemplate(false, 'moderate');

    $context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
    $context['robot_no_index'] = true;

    // Can they approve any posts?
    if ($modSettings['postmod_active'])
        $approve_boards = boardsAllowedTo('approve_posts');

    // This is the menu structure - refer to Subs-Menu.php for the details.
    $moderation_areas = array(
        'main' => array(
            'title' => $txt['mc_main'],
            'areas' => array(
                'index' => array(
                    'label' => $txt['moderation_center'],
                    'function' => 'ModerationHome',
                ),
                'modlog' => array(
                    'enabled' => !empty($modSettings['modlog_enabled']),
                    'label' => $txt['modlog_view'],
                    'file' => 'Modlog.php',
                    'function' => 'ViewModlog',
                ),
                'notice' => array(
                    'file' => 'ModerationCenter.php',
                    'function' => 'ShowNotice',
                    'select' => 'index'
                ),
                'warnings' => array(
                    'label' => $txt['mc_warnings'],
                    'enabled' => $modSettings['warning_settings']{0} == 1,
                    'function' => 'ViewWarnings',
                    'subsections' => array(
                        'log' => array($txt['mc_warning_log']),
                        'templates' => array($txt['mc_warning_templates'], 'issue_warning'),
                    ),
                ),
                'userwatch' => array(
                    'label' => $txt['mc_watched_users_title'],
                    'function' => 'ViewWatchedUsers',
                    'subsections' => array(
                        'member' => array($txt['mc_watched_users_member']),
                        'post' => array($txt['mc_watched_users_post']),
                    ),
                ),
            ),
        ),
        'posts' => array(
            'title' => $txt['mc_posts'],
            'enabled' => $user_info['mod_cache']['bq'] != '0=1' || !empty($approve_boards),
            'areas' => array(
                'postmod' => array(
                    'label' => $txt['mc_unapproved_posts'],
                    'enabled' => $modSettings['postmod_active'],
                    'file' => 'PostModeration.php',
                    'function' => 'PostModerationMain',
                    'custom_url' => $scripturl . '?action=moderate;area=postmod;sa=posts',
                    'subsections' => array(
                        'posts' => array($txt['mc_unapproved_replies']),
                        'topics' => array($txt['mc_unapproved_topics']),
                    ),
                ),
                'attachmod' => array(
                    'label' => $txt['mc_unapproved_attachments'],
                    'enabled' => $modSettings['postmod_active'],
                    'file' => 'PostModeration.php',
                    'function' => 'PostModerationMain',
                    'custom_url' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
                ),
                'reports' => array(
                    'label' => $txt['mc_reported_posts'],
                    'enabled' => $user_info['mod_cache']['bq'] != '0=1',
                    'file' => 'ModerationCenter.php',
                    'function' => 'ReportedPosts',
                    'subsections' => array(
                        'open' => array($txt['mc_reportedp_active']),
                        'closed' => array($txt['mc_reportedp_closed']),
                    ),
                ),
            ),
        ),
        'groups' => array(
            'title' => $txt['mc_groups'],
            'enabled' => $user_info['mod_cache']['gq'] != '0=1' || allowedTo('manage_membergroups'),
            'areas' => array(
                'groups' => array(
                    'label' => $txt['mc_group_requests'],
                    'file' => 'Groups.php',
                    'function' => 'Groups',
                    'custom_url' => $scripturl . '?action=moderate;area=groups;sa=requests',
                ),
                'viewgroups' => array(
                    'label' => $txt['mc_view_groups'],
                    'file' => 'Groups.php',
                    'function' => 'Groups',
                ),
            ),
        ),
        'prefs' => array(
            'title' => $txt['mc_prefs'],
            'areas' => array(
                'settings' => array(
                    'label' => $txt['mc_settings'],
                    'function' => 'ModerationSettings',
                ),
            ),
        ),
    );


Title: Re: [SMF 2b3] Moderation Center - Reported Posts
Post by: rsw686 on May 04, 2008, 10:36:27 PM
Well that code only works if I remove the following line. Otherwise I get a unable to load template '' error.

   loadTemplate(false, 'moderate');

The does remove the menu items that shouldn't be shown when just "Access the moderation center" is checked. However the "Moderation Log" menu item doesn't show any entries when there actually are. Also the "Watched Users" "View by member" works, but the "View by post" states there are no watched users when there actually are.

I'm not sure what just the permission "Access the moderation center" should allow.
Title: Re: [SMF 2b3] Moderation Center - Reported Posts
Post by: SleePy on May 04, 2008, 10:50:07 PM
Yes. There was a couple other bugs. I remember an issue with moderation log not showing correctly because of what access permissions they had. With permission from Jay, I attached the ModerationCenter.php file from SVN. This one should have fixes for most of these bugs. I can't say much for if it works though since its had changes since the public release of 2.0 Beta 3.