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.

When user registers to my site I want to make them inactive by default so I can manually update their status and send them their login info. I am using wordpress 3.1.2. Is it possible? Are there any plugins for this?

BTW, I am using Cimy User Extra Field plugin to add more fields to the registration page.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
/*
Plugin Name: Role-less New Users
Description: Removes all roles from new registrations.
Author: 5ubliminal
*/
// Hook into the registration process
add_action('user_register', function($user_id){
    $user = new WP_User($user_id);
    // Remove all user roles after registration
    foreach($user->roles as $role){
        $user->remove_role($role);
    }
}, 11);

Create a new .php file. Paste the code above in it. Put it in your /wp-content/plugins folder and activate it. Do test it!

PS: Be advised, PHP 5.3 syntax, closures used. Incompatible with PHP 5.2 or older.

share|improve this answer
    
Thanks for the code –  wannabeprogrammer Oct 12 '11 at 11:05

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.