3

I was looking at the user table and noticed for a super admin ( have access to network admin panel ) and an admin to a network site have same wp_capabilities which is a:1:{s:13:"administrator";b:1;} and also the wp_user_level is 10 for both.

So, I was wondering what is the database value that differentiate between a super admin and an admin? I don't see any more usermeta that relates to network admin level.

What is the proper way to assign super admin capability to a admin via:

  1. Database Edit.
  2. Via Code.

2 Answers 2

5

An administrator is a user on the current site with the role administrator.

Super admins/Site admins however are stored in a site option as an array of usernames.

For example, using SQL in MySQLWorkbench you can do a query such as this:

SELECT * FROM wp_sitemeta where meta_key='site_admins';

To get back a serialised PHP array. Modifying this value by adding your username and user ID will make you a site admin.

If you're just looking to see who is a site admin, you have these functions:

get_site_admins();
is_super_admin();

If on a single site rather than a multisite, any user with the delete_users capability will be regarded as a super admin.

Note that a user who is a site/super-admin does not need to have a role on a site to perform administrator actions. This can lead to oddness since a super admin can author a post on a blog they are not technically a part of, which can be confusing when they don't show in that blogs user list as they don't have a role on that blog.

0

I checked the MultiSite Database and found following two entries in wp_sitemeta table which differentiate between a super admin and an admin.

admin_user_id and site_admins

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.