5

in wordpress multisite when we give to site admin the option to add new users, site admin dont have the "checkbox" to add the new user without sending the user email with link activation (see the screenshot)

enter image description here

how can we add this option to site admin?

0

Paste this in your functions.php file:

function my_skip_confirmation_email() {
    if ( is_multisite() && current_user_can( 'create_users' ) ) { ?>

    <table class="form-table">
        <tr>
            <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
            <td>
                <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" />
                <label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
            </td>
        </tr>
    </table>
    <?php }
}
add_action( 'user_new_form', 'my_skip_confirmation_email' );
| improve this answer | |
  • Please explain how this code works. – Nathan Johnson Mar 7 '18 at 15:41
  • All this does is add a checkbox that SAYS to add the user and bypass the confirmation email, but it doesn't actually achieve that. – MadtownLems Apr 12 '19 at 14:46
0

Add the following to your funcitons.php file

    function skp_custom_user_create_fields($user){
    if (!is_super_admin( $user_id )) {
?>

    <table class="form-table">
        <tr>
            <th scope="row"><?php _e('Skip Confirmation Email') ?></th>
            <td><input type = "checkbox" name = "noconfirmation" value = "1" <?php checked( $_POST['noconfirmation'], 1 ); ?> /> Add the user without sending an email that requires their confirmation.</td>
        </tr>
    </table>
<?php
    }
}
add_action("user_new_form", "skp_custom_user_create_fields");

function skp_auto_activate_users($user, $user_email, $key, $meta){

    if(!current_user_can('manage_options'))
        return false;

    if (!empty($_POST['noconfirmation']) && $_POST['noconfirmation'] == 1) {
        wpmu_activate_signup($key);
          return false;
    }
}
add_filter('wpmu_signup_user_notification', 'skp_auto_activate_users', 10, 4);

That would do the job.

| improve this answer | |

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.