I am working on getting a copy of a WordPress MU network up and running on my local machine for development purposes (using WordPress 3.2.1 at the moment). I need access to the network administration options.
In the usermeta table, I changed my user-level
to 10
and capabilities
to a:1:{s:13:"administrator";b:1;}
In the sitemeta table, I added myself to the serialized array of users in the site_admins
option.
While this did get me access to the generic wp-admin page, I still do not have access to any of the network admin options (such as automatic upgrade for WP, plugins, or themes, etc).
So, it turns out that those three changes were all that were needed. It also turns out that if any of the serialized arrays are modified incorrectly (which is easy to do when modifying them by hand), the system will just assume you are not a network administrator.
Correcting the serialized array for the
site_admins
option fixed the problem.If you can connect via SSH, you can also add super-admin rights to existing user with WP-CLI by running command
wp super-admin add <username>
on the server.As you are running a copy of the website in your local machine. Open your terminal, install WP-CLI globally and once it’s installed, go to your website folder and type:
wp super-admin add <username>
.I hope it helps.
Just in case the format for the serialised array in
meta_value
wheremeta_key='site_admins'
in thesitemeta
table isn’t clear to someone (like it wasn’t clear to me).a:5:{i:0;s:5:"admin";i:1;s:9:"user12345";i:2;s:4:"user";i:3;s:5:"user1";i:4;s:8:"user1234";}
a:5
at the beginning of the array indicates that the array has five elements.Each element’s length is also indicated by
s:x
, where x is the length of the array element. For example, theadmin
username length is shown bys:5
the other dude mysql query doesnt work and doesnt make you a network super admin, but this one does!
now explaining this:
the most trickiest part for a super admin is the last query!
a:3:{i:0;s:5:”admin”;i:1;s:9:”user12345″;i:2;s:10:”user234567″;}
âa:3â -> for network Admins, there will be 3. The succeeding text will now list them.
âi:0â, âi:1â, âi:2â -> This is the user order: Admin1, Admin2, Admin3, etc.
âs:5â, âs:9â, âs:10â -> This represents the number of characters of the declared username! This apparently was added as a security feature of sorts. If the number of characters are off than this will not work!
âadmin,â âirisemedia,â etc. -> This is the declared username that will be associated with the Network Admins
To learn more about this read more here
Note: change the password!
Here is the queries to create a new admin user :
It will definitly help you. 🙂
I had been struggling with this issue for days, ie. When I updated the domain name of my main network site, the network admin option disappeared from the dashboard. Tried to look all over the place. Finally ended up on this question and once I read locoMotion’s explanation of what the fields in sitemeta table mean, I noticed that the length of the username for the superadmin was not correct. When I fixed that, the SiteAdmin menu started showing up on the dashboard again. Thanks @quadium32 for asking this question and special thanks @locoMotion for explaining what the sitemeta values mean. Best Regards. Tariq
Run
grant_super_admin(<user_id>);
after adding the user. (Probably by placing it in theme’sfunction.php
file)