1

I've lost the wp_users and wp_usermeta tables in a wordpress installation. I've recreated them and insert a new admin user. In particular, in wpAA_users (I use the prefix wpAA_), I have now a user admin with ID=1, while in wpAA_usermeta, for user_id=1 I have wp_cabilities set to a:1:{s:13:"administrator";b:1;} and wp_user_level set to 10.

Now, when I log in to the site the top tool bar shows on the left the general wordpress menu, then the name of the user without the Dashboard menu, and on the right again the hello user name menu (here is a link to the site).

I looked at the wpAA_user_role option in the wpAA_options table, that contain a long string, starting with:

a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:71:{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";...

I do not know if the user that I've created is not really an administrator, or if something else horribly wrong happened.

So my question is: there is some error in the way used to create a new administrator, or at least how can I diagnose the problem?

Note: I have four or five plugins, and use theme Twenty Seventeen.

2
  • Looks OK to me at first glance. You could try using wp cli to make an admin user too?
    – Rup
    Commented Jan 5, 2020 at 17:41
  • I've create another admin user directly in the database, but the result is the same. Note that I cannot open a shell on the wp server.
    – Renzo
    Commented Jan 5, 2020 at 17:42

1 Answer 1

0

The problem was in the names of the meta keys of the wpAA_users table: instead of using wp_capabilities and wp_user_level I should have used the actual prefix, that is wpAA_capabilities and wpAA_user_level.

With these modifications I can now access the site as administrator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.