0

I have a multisite setup where I would like site Administrators to be able to add New Users with the Skip Notification Email option.

By default, Wordpress only allows Super Administrators this privilege in a multisite setup. I have used the code below to fix this problem except it logs the Administrator out after each New User is added. I have tried removing the redirect line but the administrators are still being logged out.

function your_disable_activation( $user, $user_email, $key, $meta = '' ) {
// Activate the user
$user_id = wpmu_activate_signup( $key );

wp_set_auth_cookie( $user_id, true, is_ssl() );

wp_redirect( /*redirect to */ site_url() );
exit;
}
add_filter( 'wpmu_signup_user_notification', 'your_disable_activation', 10, 4 );

How can I run this code (or similar code) without the Administrator being logged out each time?

Thanks!

  • If you disable notification, how do users get their password? Why are you resetting the auth_cookie... that is most likely your problem with the admin being logged out. Also not sure you should exit there, just return false. – user42826 Mar 20 '15 at 7:31
  • Thanks for your reply. I would like the Administrators to Add a new User and decide the password themselves. In this system, the new users will receive their password physically via paper (It's education based). This is why the email notification should be disabled. I will experiment with the return false and resetting of the auth_cookie. Thanks again :) – Laurence Stanley Mar 21 '15 at 9:10
0

Update: I've got it working now! It still shows a text box that says the User email must be confirmed, but it DOES create the user regardless of that information. Here is the code I have used:

function your_disable_activation( $user, $user_email, $key, $meta = '' ) {
// Activate the user
$user_id = wpmu_activate_signup( $key );

wp_redirect( /*redirect to */ site_url() );
return false;
}
add_filter( 'wpmu_signup_user_notification', 'your_disable_activation', 10, 4 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.