Change WordPress user roles and capabilities Forums Bug Reports Activating User Role Editor Pro breaks my website

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2021
    orangesandlime
    Participant

    Hi!

    I’m getting the following error message when activating the User Role Editor Pro plugin:

    Warning: Invalid argument supplied for foreach() in wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php on line 72

    Warning: Cannot modify header information – headers already sent by (output started at wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php:72) in /home/redlovec/public_html/wp-includes/pluggable.php on line 1207

    and my website doesn’t load.

    I have deactivated the plugin for now.

    Pleas advise. Thank you!

    Nancy

    #2022
    Vladimir
    Keymaster

    Hi Nancy,

    Thanks for the information. I will enhance this part of the code and include it to the next update.

    It seems that WP_DEBUG constant is set to true at your site. It’s not recommended for the live sites. So 1st workaround is to set it to false at wp-config.php file.
    2nd way is to modify wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php file replacing code phragment at lines 72-89 with this one:

    
            if (is_array($user->roles)) {
                foreach ($user->roles as $role) {
                    if (isset($access_data[$role])) {
                        if (!isset($access_data[$role]['access_model'])) { // for backward compatibility
                            $access_model = 1;   // Use default (block selected) access model
                            $data = $access_data[$role];
                        } else {
                            $access_model = $access_data[$role]['access_model'];
                            $data = $access_data[$role]['data'];
                        }
                        if (empty($blocked['access_model'])) {  
                            $blocked['access_model'] = $access_model;    // take the 1st found role's access model as the main one                    
                        }
                        // take into account data with the same access model only as the 1st one found
                        if ($access_model==$blocked['access_model']) {
                            $blocked['data'] = array_merge($blocked['data'], $data);
                        }
                    }
                }
            }
    

    That is insert
    if (is_array($user->roles)) { just before it. And insert closing } just after it.
    I may send a modified file to your e-mail if it’s required.

    #2024
    orangesandlime
    Participant

    Hi Vladimir,

    Thank you so much for getting back to me. That did the trick! User Role Editor is working perfectly now.

    Cheers,
    Nancy

    #2027
    Vladimir
    Keymaster

    Hi Nancy,

    Thanks for the feedback.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.