When creating new blogs, the user created for that blogs has not the Administrator role

We are having a problem when creating new blogs. The blog creation is ok but users have not the Administrator role asigned.

In fact, the user has not any role.

We need to solve this because we have to assign the role manually.

Any suggestions???

  • Vinod Dalvi

    Hi Jaime,

    Welcome to the WPMU Dev community and thanks for posting on the forum.

    Are you talking about creating a new blog from front end of the site or from the admin area?

    This can be due to plugin/theme conflict on your site.

    You can just try on your development site temporary using default WordPress theme like Twenty Fifteen and temporary deactivating all other plugins as displayed in the following flowchart to know which theme/plugin is conflicting if any.

    https://premium.wpmudev.org/manuals/getting-support/

    Would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,
    Vinod Dalvi

  • Jaime

    Ok, we granted you access to our site. We use WHMCS to create blogs. If we done using our dashboard, everything is ok, but when using WHMCS the rol isn't assigned. We made test changing the role and we realize that only the Administrator role is the one that is not assigned. Editor, Suscriptor, Collaborator, all the roles are asigned, but not the Administrator.

    Access is granted until 26 of July. If you need more time just tell us

    Thanks in advance for your help

  • Ash

    Hello @Jaime

    I hope you are well today.

    Would you please try the following code?

    function ds_new_user_meta( $blog_id, $user_id ) {
        add_user_to_blog( $blog_id, $user_id, 'administrator' );
    }
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 999, 2 );

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.