WordPress.org

Ready to get started?Download WordPress

Forums

User Role Editor
[resolved] Reset in user role editor - lost access (27 posts)

  1. orjanmen
    Member
    Posted 11 months ago #

    Hi.
    Pressed "reset" to reset that particular role, but it seemed to reset my whole page. Now I have no access to some plugins. How do I get this back? Before i pressed reset, I had a box extra in User Role Editor-window, where I could choose access to plugin. I want that box back.

    - Please respond. Huge trouble here.

    http://wordpress.org/plugins/user-role-editor/

  2. Vladimir Garagulya
    Member
    Plugin Author

    Posted 11 months ago #

    Hi,

    "Reset" is applied to ALL roles, not to the selected one only. Plugin shows you this warning before action:
    "Reset Roles to WordPress defaults. Be careful, all changes made by you or plugins will be lost. Some plugins, e.g. S2Member, WooCommerce reactivation could be needed. Continue?".
    So deactivate/activate plugin which capabilities you lost at the "Custom Capabilities" section of User Role Editor. That plugin will create its capabilities set again.

  3. fountain institute
    Member
    Posted 10 months ago #

    HI I am having the same issue, I reset my role editor accidently but i got no warning messages. Now i am not bale to deactivate plugins as the plugin tab in the Dashboard does not appear, nor do I have pages, users etc.

    I have tried to amend the admin meta table filed in SQL database but this has not helped.

    Urgently need help to get adminitrator with full access, i have allot of plugins installed.

    Can someone advise what I should do.

  4. Vladimir Garagulya
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    I suppose you user has not standard "Administrator" role assigned, but some custom created role. Right? If Yes, it was lost after reset. This function executed the same core code which WordPress uses to create its standard roles during installation. No one custom line of code is executed there.

    Check what role your user has with this SQL command:

    select * from wp_usermeta where user_id=1 and meta_key='wp_capabilities';

    replace user id with your user ID and replace database prefix from the default 'wp_' to the one you use. Replace it to the "administrator".
    It should be like this

    a:1:{s:13:"administrator";b:1;}
  5. fountain institute
    Member
    Posted 10 months ago #

    The username is Adminitrator and the and the wp_capabilities is set to as follows:

    a:1:{s:13:"administrator";b:1;}

  6. fountain institute
    Member
    Posted 10 months ago #

    Sorry username: Administrator

  7. Vladimir Garagulya
    Member
    Plugin Author

    Posted 10 months ago #

    Check the result of this command:

    select * from wp_options where option_name='wp_user_roles';

    it should be the same as these data - just after "Reset" click on my test site:

    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:62:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:9:"add_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}
  8. fountain institute
    Member
    Posted 10 months ago #

    did thats and it shows this:

    a:8:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";

  9. fountain institute
    Member
    Posted 10 months ago #

    a:8:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:8:{s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:7:"level_0";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:12:"upload_files";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:24:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:11:"edit_events";b:1;s:14:"edit_locations";b:1;s:13:"delete_events";b:1;s:15:"manage_bookings";b:1;s:16:"delete_locations";b:1;s:16:"edit_recurrences";b:1;s:21:"read_others_locations";b:1;s:17:"email_single_user";b:1;s:20:"email_multiple_users";b:1;s:21:"edit_recurring_events";b:1;s:23:"delete_recurring_events";b:1;s:19:"upload_event_images";b:1;s:19:"read_private_events";b:1;s:22:"read_private_locations";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:18:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:11:"edit_events";b:1;s:14:"edit_locations";b:1;s:13:"delete_events";b:1;s:15:"manage_bookings";b:1;s:16:"delete_locations";b:1;s:16:"edit_recurrences";b:1;s:21:"read_others_locations";b:1;s:17:"email_single_user";b:1;s:21:"edit_recurring_events";b:1;s:23:"delete_recurring_events";b:1;s:19:"upload_event_images";b:1;s:19:"read_private_events";b:1;s:22:"read_private_locations";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:8:{s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:7:"level_0";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:12:"upload_files";b:1;}}s:16:"sacredstudyyear1";a:2:{s:4:"name";s:16:"SacredStudyYear1";s:12:"capabilities";a:8:{s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:7:"level_0";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:12:"upload_files";b:1;}}s:16:"sacredstudyyear2";a:2:{s:4:"name";s:16:"SacredStudyYear2";s:12:"capabilities";a:12:{s:4:"read";b:1;s:7:"level_0";b:1;s:11:"edit_events";b:1;s:14:"edit_locations";b:1;s:13:"delete_events";b:1;s:15:"manage_bookings";b:1;s:16:"delete_locations";b:1;s:16:"edit_recurrences";b:1;s:21:"read_others_locations";b:1;s:21:"edit_recurring_events";b:1;s:23:"delete_recurring_events";b:1;s:19:"upload_event_images";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:14:{s:4:"read";b:1;s:7:"level_0";b:1;s:11:"edit_events";b:1;s:14:"edit_locations";b:1;s:13:"delete_events";b:1;s:15:"manage_bookings";b:1;s:16:"delete_locations";b:1;s:16:"edit_recurrences";b:1;s:21:"read_others_locations";b:1;s:21:"edit_recurring_events";b:1;s:23:"delete_recurring_events";b:1;s:19:"upload_event_images";b:1;s:19:"read_private_events";b:1;s:22:"read_private_locations";b:1;}}s:8:"teachers";a:2:{s:4:"name";s:8:"Teachers";s:12:"capabilities";a:8:{s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:7:"level_0";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:12:"upload_files";b:1;}}}
  10. fountain institute
    Member
    Posted 10 months ago #

    Can you advise how to proceed?
    Thanks

  11. Vladimir Garagulya
    Member
    Plugin Author

    Posted 10 months ago #

    The reason of your problem with access is that your administrator role contains just 8 capabilities

    a:8:{s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:7:"level_0";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:12:"upload_files";b:1;}}

    Replace this field value with one as it should be from my yesterday post above.

  12. sofiette
    Member
    Posted 5 months ago #

    HI
    I've got the same issue and i don't know what is wrong? Any idea?

    Thanks for your help

    'wp_capabilities'
    a:1:{s:13:"administrator";b:1;}

    'wp_user_roles'
    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:63:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:13:"mc_add_events";b:1;s:17:"mc_approve_events";b:1;s:16:"mc_manage_events";b:1;s:12:"mc_edit_cats";b:1;s:14:"mc_edit_styles";b:1;s:17:"mc_edit_behaviors";b:1;s:17:"mc_edit_templates";b:1;s:16:"mc_edit_settings";b:1;s:17:"mc_edit_locations";b:1;s:12:"mc_view_help";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

  13. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    It seems your administrator role is fine.
    Please read this post
    http://role-editor.com/how-to-restore-deleted-wordpress-user-roles/
    May be it may help.

  14. sofiette
    Member
    Posted 5 months ago #

    Thanks. I tried different solution but eventually i don't have any administrator register and i can't create one so i can't use the plugin 'User role editor' to add manually capabilities. I tried to reactivate missing plugin but nothing changes. I tried the third variant but same...

    Any idea???

  15. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    Is it single site WP installation?

  16. sofiette
    Member
    Posted 5 months ago #

    yes

  17. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    It seems you broke something else. If you created backup copy before update DB if SQL commands manually, it is better to restore it and begin from the zero point.

    This work for your favorite MySQL client. I suppose that WordPress DB tables has 'wp_' prefixe at your database:
    1) get the user ID of the user which should have the administrator rights from the wp_users db table. Suppose it is 1.
    2) Check his current rights:

    select * from wp_usermeta where user_id=1 and meta_key='wp_capabilities';

    He should have at least

    a:1:{s:13:"administrator";b:1;}

    at the meta_value field.
    3) restore it with command below (I use record ID from the prev. step, e.g. 10)

    update wp_usermeta set meta_value='a:1:{s:13:"administrator";b:1;}' where umeta_id=10;

    if such record does not exist, use insert statement.

  18. sofiette
    Member
    Posted 5 months ago #

    I manage to restore the administrator permission but still missing two plugin : tablepress and nextgen gallery.... I dont have any backup !!!!!!!!!!!!!!! for my DB

  19. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    Read this post
    http://role-editor.com/nextgen-gallery-restore-lost-capabilities
    You may use the same technique for the other caps.

  20. sofiette
    Member
    Posted 5 months ago #

    Do you have any idea ??? I'm stocked because of this plugin and i can't find any issue !

  21. sofiette
    Member
    Posted 5 months ago #

    in wp-content i have to create a folder /mu-plugins and copy the file must-use.php with code inside?
    i've got a error message in all admin :
    function restore_lost_capabilities() { global $wp_roles; $caps_to_restore = [ 'NextGEN Gallery overview', 'NextGEN Use TinyMCE', 'NextGEN Upload images', 'NextGEN Manage gallery', 'NextGEN Manage others gallery', 'NextGEN Manage tags', 'NextGEN Edit album', 'NextGEN Change style', 'NextGEN Change options', 'NextGEN Attach Interface' ]; $role = $wp_roles->get_role('administrator'); foreach($caps_to_restore as $cap) { if (!$role->has_cap($cap)) { $role->add_cap($cap, true); } } } add_action('admin_init', 'restore_lost_capabilities');

  22. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    I supposed - you know that any PHP file should start from <?php, e.g.

    <?php

    Add it to the begin of must-use.php file you created.
    More info about mu-plugins is available here
    http://codex.wordpress.org/Must_Use_Plugins

  23. sofiette
    Member
    Posted 5 months ago #

    ouuupppsss sorry !!!! it works. Gallery appeared. I need just more help for Tablepress ?

  24. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    Install that plugin to other site (local). Look what capabilities it adds.
    Add them to your broken site the same way you did it for NG Gallery.

  25. sofiette
    Member
    Posted 5 months ago #

    I complete the file :

    <?php function restore_lost_capabilities() {
    
        global $wp_roles;
    
        $caps_to_restore = [
            'NextGEN Gallery overview',
            'NextGEN Use TinyMCE',
            'NextGEN Upload images',
            'NextGEN Manage gallery',
            'NextGEN Manage others gallery',
            'NextGEN Manage tags',
            'NextGEN Edit album',
            'NextGEN Change style',
            'NextGEN Change options',
            'NextGEN Attach Interface',
            'tablepress Access about screen',
            'tablepress Access options screen',
            'tablepress Add tables',
            'tablepress Copy tables',
            'tablepress Delete tables',
            'tablepress Edit options',
            'tablepress Edit tables',
            'tablepress Export tables',
            'tablepress Import tables',
            'tablepress Import tables wptr',
            'tablepress List tables'
    
       ]; 
    
        $role = $wp_roles->get_role('administrator');
        foreach($caps_to_restore as $cap) {
            if (!$role->has_cap($cap)) {
                $role->add_cap($cap, true);
            }
        }
    
    }
    
    add_action('admin_init', 'restore_lost_capabilities');
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    It appears in capabilities custom but the plugin is not back.

  26. Vladimir Garagulya
    Member
    Plugin Author

    Posted 5 months ago #

    Look on these capabilities at the Role Editor with "Human readable form" switched off. You should add them with "underscores" and in lowercase, in which form they defined, I'm sure. NG Gallery the only plugin I met, which does not respect WordPress policy about capability names structure.

  27. sofiette
    Member
    Posted 5 months ago #

    Thanks a lot for your help. Every thing is ok now .

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.