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!

2
  • 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. Commented Mar 20, 2015 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 :) Commented Mar 21, 2015 at 9:10

1 Answer 1

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 ); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.