Missing Roles in Drop-Downs for Add New Users

This is a little strange and I hope it's not a silly mistake or lack of understanding on my part. I have created a bunch of blogs using the same single master admin account / email.

I'm now trying to add additional users with various author / editor roles to certain blogs (subdomains). In the core admin "Add New" under Users section the drop-down for Role is blank. I can create the user, generate the email, validate with the link and get a password. But when I try to use the new account to log in it says I don't have any permissions for that site.

I thought maybe there was a bug or something some where and maybe Add New Users plugin would circumvent. But it has the same issue - on sub-blogs the Role drop-downs are blank. On the main blog, they have the expected values.

What am I doing wrong? Currently, I can't add any users above the default subscriber level on any of my blogs. Arg!

Many thanks!

    ClvrTv

    CORRECTION/UPDATE: after walking through many more blogs... it appears that only some of them demonstrate the issue. So, perhaps it is not as widespread as I thought. Whew! But still perplexing and definitely still an issue with some sites.

    Anyone see this before / have any recommendations where to start looking? I am trying to isolate the difference on the ones that are broken. Thanks again.

    Aaron

    The only thing I can think is that the blogs were not created correctly. Are there any errors in your logs? That dropdown is a core WP function, so it must be something major. You may want to try overwriting your WPMU files with a fresh copy in case something is corrupt there.

    Also do you have any kind of role modification plugin installed?

    ClvrTv

    Ok.. thanks for your stabs in the dark (just like me - it's a needle in the haystack scenario!!!) - and you're in the ballpark at least. Arg... it seemed sporadic before, but now I have more info for you to go on after lots of scenario testing, so hopefully someone with more experience in the WPMU guts can provide a nugget. I think I'm close, but still no solution.

    Here's the big picture issue:

    Standard sites created the normal way work as expected.

    We have a large number of sites that start out identically. So, I mashed together several chunks of various plugin code and massaged it all to come up with a Cloner that can copy one site to another with just a few fields filled in and a single click. It is SWEET. It factors in all necessary data and name replacements and clones everything: template, plugins, the works. I must have now found perhaps the last issue of the prototype and this one is a doozie since it means I can't add users to cloned sites LOL.

    Yes, the clones exhibit the problem whereas other sites do not. Bummer.

    Observations so far:

    The only unique thing about the site that (I just discovered) gets overwritten by the Cloner after scrubbing SQL dumps is the _options table random_transient_seed value, which after some research is supposedly the Md5 hash of the blog id. Is this indeed the case? Does anyone know how this is used by WordPress?

    I thought I had success by regenerating this manually, updating one of the affected blogs and creating a new user. But it seemed to work on one site and not another.

    Another interesting quirk: none of the users created with the WPMU Dev Add New User plugin are added to the main blog id 1 as a subscriber. Is this expected? Or maybe part of my issue?

    If I add that role directly in the _sitemeta table, a user who previously could not log into their blog can now log in. However, even though they have the Author Role, they cannot create a new post. Almost all links in the dashboard just refresh the dashboard. Oddly, though, they can post via the QuickPress tool, and the post goes through and is visible on the home page but page not found on the post itself.

    Yes, all very bizarre.

    Also, interesting is that users and meta is stored completely outside of all blog tables. Right? So, cloning should not really be a problem. But what am I changing by cloning that WP is looking for and not finding. I thought I had the solution with the random_transient_seed value... but it didn't resolve everything like I hoped.

    Also, if I try to add an existing user to a blog... I can add them to the blog just fine, but can't choose a role. So, then when I visit their profile to update their role in that blog the drop down just says -- No Role for This Blog -- with no other options.

    I feel like if I just understood how WP stored, managed, and expected users and roles I could fix this. Re-doing all these sites isn't an option. The fix for this issue will be incorporated into the Cloner.

    So, I guess that's a whole lot to say:
    - Is Add New User plugin supposed to also add subscriber role to main blog id 1 for each user created?
    - Anyone know how WordPress uses the random_transient_seed value in the wp_*_options table? And if so, is it truly the Md5 hash of the blog id?
    - Anyone know the ins and outs of what WordPress is expecting for valid user accounts? What values should be in what tables? What is WP looking for that it can't find when the normal "Add new" user page comes up?

    MANY THANKS! I know this is a gnarly issue down in the weeds and not very brief in the explanation.

    Barry

    I'll pop over some tables and values to look for, as it may help narrow things down.

    Picking an arbitrary, random blog number - 61.

    The roles available on that blog are held in wp_61_options with an option name of "wp_61_user_roles". This is quite a large serialised array, so would be best to copy from somewhere else rather than try to manually create.

    The roles of a particular user is held in the wp_usermeta table - in this case it will be in rows with a meta_key of wp_61_capabilities - again it's a serialised array.

    You can ignore the transients, they are created, if they don't already exist, when needed. It is used to create a random option name for the transient options that WP uses. These are options with "time limits" - such as the RSS feeds, that are supposedly automatically removed and recreated after the specified time limit.

    Aaron

    I bet you aren't copying that option correctly "wp_61_user_roles", as it is one of a few that have to be modified to work on a nother blog.

    ClvrTv

    Bingo. I haven't tried it yet, but I bet you guys are totally right. I missed that one in the (currently) several hundred rows of the _options table. I probably have a couple dozen blogs out there that have identical rows corresponding to "wp_61_user_roles" when each one should have their own like wp_32_user_roles, wp_33_user_roles, etc....

    This would also explain why login isn't working right on those blogs - it's taking the assigned role from the _usermeta table but doesn't have anything to compare it to because it's looking for the wrong prefix meta key in the corresponding _options table.

    Thankfully, it's pretty easy to correct and also to fix in the cloner. Outstanding!

    Will let you know the final outcome, but I'm pretty sure that has to be it. The value is already ok since I haven't customized any of the roles. All I have to do is sync the keys back to their respective blogs. Thanks a million, guys!

    ClvrTv

    That was INDEED the culprit!

    as it is one of a few that have to be modified to work on a nother blog.

    Any other little things come to mind along those same lines? (Any other mods that have to be made when copying tables to another blog?) I have covered the following already:
    - domain name: site1.domain.com > site2.domain.com in _options
    - appropriate plugin replacements related to the blog id.
    - (now) the _user_roles in _options

    Anything else jump to mind? Not seeing any other issues at this point, but I'd rather fix something now so I don't have to run a bunch of manual queries later to keep it all straight.

    Again, much appreciated!

    Shawn

    THANK YOU! This one tip just resolved the most significant remaining problem I've had migrating some 40k blogs from another platform to WPMU+BP.

    Jason Pelker
    • 28
    • #4,231

    What's the deal with that site cloner you were boasting about;)?

    Aaron

    It sounds like basically the same thing as our new Blog Templates plugin. You should check that out @jpelker

Join 368405 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member