Need to create a new admin user in mysql

mysql
solved
#1

Expected behavior

Followed this guide:


to insert a new admin in mysql after accidentally deleting the main one from simple WordPress membership dashboard.
The expected behavior is the ability to log in as the admin with the new user.
To create the new user I deleted the plugin from files and cleaned relevant database tables because it has its own registration/login pages and skips the cp standard process.

Current behavior

After the procedure, it logs in, as a subscriber with no dashboard access.

Steps to reproduce

Include code to reproduce, if relevant.

  1. install Wordpress Simple Membership plugin and its free add-ons (recaptcha and the one to sync wp users with members)
  2. sync members with wp registered users
  3. try and delete the new members from the WordPress simple membership dashboard. It is going to delete also the registerd users on the site, not only their member status
  4. delete all plugins files, delete mysql tables, clean mysql.
  5. perform the steps in the tutorial mentioned above.

Context

I need to regain access to the dashboard. Is there something else I can try before reverting to a previous backup? Also what happens with the content I created before deleting the admin, is there a way to assign it to the new admin?

Thanks for helping me out!

1 Like
#2

Copying possible solution from Slack:

Zulfikar (@zulfgani) [10:48 AM]
When inserting the meta_key in user meta make sure the prefix matches your database prefix. In the tutorial it states wp_capabilities however if your DB prefix is other than wp_ then it wont work

1 Like
#3

tried that, didn’t solve.
it continues to log in as a user (subscriber I think).
Is there any place in mysql except for user and usermeta where cp handles users capabilities and roles?

1 Like
#4

Adding entire Slack conversation for reference of things that has been tried.

#5

Solved by deactivating plugins (renamed plugins and shield folder in wp-content and following wpbeginners tutorial

(that is totally the same as the first I was using)

closed #6

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.