Support

Home Forums Event Espresso Premium error creating new user capability in Capability enhanced

error creating new user capability in Capability enhanced

Posted: August 11, 2017 at 8:25 pm

Viewing 3 reply threads


hroggen

August 11, 2017 at 8:25 pm

HI,
while using Capability Manager Enhanced to create a new capability for our photo editor, i accidentally clicked save when “administrator” level was showing and have now locked myself out of users. plugins and themes. i have tried creating a new user from cpanel and adding though the data base but neither can gain access. Help please.


Tony

  • Support Staff

August 14, 2017 at 4:37 am

Hi there,

I want to be clear here and state that this is outside the scope of EE support, however, we will help if we can.

Creating another admin account won’t help as with the above you’ve removed the capabilities from the admin role that is used by those accounts. Within Capability Manager Enhanced there is an option to backup and restore your site’s capabilities (there is also an option to reset the caps to default but that will lose ANY caps added by other plugins, so should be a last resort), if you haven’t backed your user roles this is a great example of why you should be.

Capability Manager Enhanced may have a better method for fixing this but you’ll need to check with them.

I think the best/easiest option for you is to just get the User list showing for the admin account again, you can then go to Users -> Capabilities to edit the caps on the admin role again and give it all caps.

Before moving forward, create a full database backup of your site. If something goes wrong you will need it and if you don’t have a backup we can’t help as its way outside our support. It’s pretty unlikely with the code you’ll be using but either way it’s a heads up and better safe than sorry.

Then using FTP you’ll need to edit your themes functions.php file, I’m assuming if you know how to add users using cPanel you have FTP access?

Within your functions.php file you can add:


function tw_fix_admin_caps() {

    // Gets the admin wp role
    $role = get_role( 'administrator' );

    // Adds the 'manage_options' and 'list_users' capability to the role.
    $role->add_cap( 'manage_options' );
    $role->add_cap( 'list_users' );

}
add_filter('admin_init', 'tw_fix_admin_caps' );

What that does is pull the admin role and then add 2 caps to it, manage_options and list_users, the admin account should always have these anyway.

Then load the admin Dashboard once, you won’t notice any difference, it won’t load the user’s list on that load, it just adds the caps to the account. Now either completely remove the above code from functions.php or comment out the last line (you don’t want to constantly add caps on each page load).

After remove the code, again refresh the Dashboard and you should now see the ‘Users’ section.

Go to Users -> Capabilites and load the Admin role in the top right, now make sure that the admin role has all caps and save. You should now have full access to your site again.

I don’t recommend just randomly adding caps to the admin account using the code, it should actually be exactly the same as adding them with CME but your much better using the GUI so just add enough to get that to load.

Disclaimer – I have no idea what caps you’ve removed from your admin role so the above still may not allow the user list to load (although it should).


hroggen

August 14, 2017 at 5:23 pm

Thank you so much for your help Tony, I have received a response from Kevin Behrens at CME that has solved the problem though phpMyAdmin. options and user roles. Just got it going now. No new creations in the small hours, errors just too easy.
regards Hazel


hroggen

August 14, 2017 at 5:27 pm

I asked for help in both support groups as the original developer no longer seems to support CME. Grateful for great support people. 🙂

Viewing 3 reply threads

The support post ‘error creating new user capability in Capability enhanced’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso