Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a multi-site network, on one of the sites the access is restricted to registered users, and only an administrator can create users.

I was asked to get rid of the confirmation email sent to new users, and I know you can select an option to add the user without sendind the email.

The problem is, that option is only available to super administrators (me) and not regular administrators.

Is there a way to add the new users without sending a confirmation email? I can get rid of the email, but I also need to remove the activation link, I need the users to be automatically added.

I've looking for hooks but I can't find anything helpful, any ideas?.

P.S. Every user is added from the Add new user menu in the backend.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Haven't really tested this, but WP actually uses this filter if you check the "noconfirmation" box, except that it does so only for super_admins, like you said:

add_filter( 'wpmu_signup_user_notification', '__return_false' );
share|improve this answer
    
Actually I figured this out days ago, but yes this was the answer, so thanks anyway. BTW I also had to edit the core to activate the users automatically... –  Mario Jan 13 '12 at 21:59
    
The ability to check the tickbox would be great for administrators to see. The answer above is a workaround - how can we allow Administrators the option? –  Innate Feb 27 '12 at 7:36

In wp-admin/user-new.php one can replace all instances of "is_site_admin" with "current_user_can('administrator')".

Then under the section "Adding a new user to this blog" around line 119, add this filter too: add_filter( 'wpmu_welcome_user_notification', '__return_false' );

Remember to edit users added without sending details and set passwords for them etc.

  • this is a bit of a hack, but there is no other way to do this is_site_admin only allows site admins and this is hard coded.
share|improve this answer

I think I figured out how to do this without editing any core files. I got things working (with minimal testing) using the following:

add_filter('wpmu_signup_user_notification', 'auto_activate_users', 10, 4);
function auto_activate_users($user, $user_email, $key, $meta){
  wpmu_activate_signup($key);
  return false;
}

The checkbox is still there on the page, but it has no effect.

As an aside, I completely disabled emails for my wordpress install by overwriting the wp_mail function:

function wp_mail($to, $subject, $message, $headers = '', $attachments = array() ){
  return true;
}

So that may have, in some way, allowed my auto_activate to work without sending emails.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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