Hello @grizzly65x
To resolve the “no role for this site” issue, install the User Role Editor Plugin (Plugin URL is: https://wordpress.org/plugins/user-role-editor/) network-side, then go to each imported site and verify or reassign user roles. Alternatively, use the code in your theme’s function.php for each imported site to reset roles:
function reset_roles(){
add_role(‘subscriber’,’Subscriber’,[‘read’ => true]);
}
add_action(‘init’,’reset_roles’);
this should refresh the roles for assigning new users.
Thanks Dilip. I had tried both of theses things.
Unfortunately the user role plugin did make the missing roles reappear in the drop down. Nor was it possible to assign them in User Role Editor itself.
Adding the code seemed to do nothing.
I was able to apply a “workaround” by assigning additional roles within user role editor but would prefer to do it via the dropdown.
Do you have any other thoughts?
Thanks
Hello @grizzly65x
Given the persistence of the issue, it could stem from a mismatch in the role configurations within the multisite database setup. Here are additional steps that could help:
Step-1. Re-register Default Roles: Adding this code will re-register WordPress’s default roles specifically for each site. Place it in each site’s functions.php
and refresh the site.
function re_register_roles() {
remove_role('subscriber');
remove_role('contributor');
remove_role('author');
remove_role('editor');
remove_role('administrator');
populate_roles();
}
add_action('init', 're_register_roles');
This should repopulate default roles and may bring them back to the dropdown.
Step-2. Database Repair: Sometimes, role tables may not properly sync across multisite installations. Running a database repair may help if there’s a possible corruption. Go to wp-config.php
and add:
define('WP_ALLOW_REPAIR', true);
Then visit https://yourwebsite.com/wp-admin/maint/repair.php
and run the repair. Remember to remove the line afterward for security.
Step-3. Multisite Role Reset Plugin: Consider a plugin like Multisite User Role Sync. This plugin specifically addresses syncing roles across multisite setups and could resolve any remaining role discrepancies. (Multisite Plugin URL: https://wordpress.org/plugins/wp-multisite-user-sync/)
for multi user: https://prnt.sc/QdJeeyUlI3I-
if you apply above suggestion, before take the backup your database and other plugins, theme.
as per my suggestion first please install the Multisite Plugin and after go with your requirement.
It sounds like the issue might be related to how roles and permissions were carried over during the import process. Double-check the user roles for those sites, ensure they’re properly configured, and verify that the necessary capabilities exist for each role. If needed, tools like User Role Editor or WP-CLI can help assign roles correctly. Also, confirm that the database of the site entries for user permissions align with the multisite setup. A quick plugin or theme conflict check might also help rule out any issues.
I also had the same issue and I found some importand links from this forum. Thanks!!
I also had the same issue and I found some importand links from this forum. Thanks!! Osceola County Property Appraiser
-
This reply was modified 1 month ago by
unden1997.