spivurno
11/10/2012 - 12:55 AM

Configure admin approval for new accounts

Configure admin approval for new accounts

/**
* Configure Admin Approval for New Accounts
* http://gravitywiz.com/
*/
remove_filter('wpmu_signup_user_notification_email', array('GFUserSignups', 'modify_signup_user_notification_message'));
add_filter('wpmu_signup_user_notification_email', 'my_modify_signup_user_notification_message');

function my_modify_signup_user_notification_message() {        
    return false;
}
    
add_action('gform_user_registered', 'my_new_user_notification', 10, 4);
function my_new_user_notification($user_id, $config, $lead, $password) {
    $user = new WP_User($user_id);

    $user_login = stripslashes($user->user_login);
    $user_email = stripslashes($user->user_email);

    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

    $message = "Thanks for signing up. Your account has been approved and you can now log in.\r\n";
    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
    $message .= "Password: the one you entered in the registration form\r\n";
    $message .= wp_login_url() . "\r\n";

    wp_mail($user_email, sprintf(__('[%s] Your account has been been approved'), $blogname), $message);
}