• I know that I can either (1) turn off ‘anybody can register’ and create logins individually/manually OR (2) turn on ‘anybody can register’ and let any stranger register to my blog. however is it possible to moderate and approve each registration, similar to comment moderation? It would be a wonderful addition to wordpress. THANK YOU SO MUCH!

Viewing 7 replies - 31 through 37 (of 37 total)
  • None of the solutions presented really works for me. I truly want a real user moderation. Since I installed wordpress for the first time ever today I don’t really know how to write a plugin, but I have hacked around a bit this evening and I got up a solution that actually sets users as not being able to login after being created from the web, but can login when created from admin. At the moment I need to manually update the mysql-table to allow them to login, but I’m working on integrating this into my “hack” as well.
    What I have used is the “user_status” field in the wp_users table. This field as far as I can see is deprecated and is no longer used. If you feel uneasy of using this field you can easily add your own one instead.
    What I’ve done is simply the following.

    1. In /wp-register.php:

    Locate the following:

    if ( !$user_id )
    $errors[‘user_id’] = [..and so on ..]
    else
    wp_new_user_notification($user_id, $password);

    Change to:

    if ( !$user_id ){
    $errors[‘user_id’] = [..and so on ..]
    }else{
    wp_new_user_notification($user_id, $password);
    $wpdb->query(“UPDATE $wpdb->users SET user_status = -1
    WHERE user_login = ‘$user_login'”);
    }

    2. In /wp-login.php:
    Locate the following:

    $user = new WP_User(0, $user_login);

    Below it, add:

    $status = $wpdb->get_var(“SELECT user_status FROM $wpdb->users WHERE user_login = ‘$user_login'”);
    if($status == -1){
    $error = ‘Your user has not been approved yet.’;
    }else{

    Locate the row:
    } else if ( $user_login || $user_pass ) {

    Add a line above with a single
    }

    Well, that’s it so far. Hope it can get someone on the right track ??

    Okey, time for the next part.
    In /wp-admin/user-edit.php locate the following:
    <legend><?php _e(‘Name’); ?></legend>
    <p><label><?php _e(‘Username: (no editing)’); ?>

    Between the <p> and <label> on line 2, insert the following:

    <table border=”0″ cellpadding=”0″ cellspacing=”0″>
    <tr>
    <td><input value=”0″ type=”checkbox” name=”user_status” id=”user_status” <?
    if($profileuser->user_status != -1){
    echo(” checked=\”checked\””);
    }
    ?>/></td>
    <td><label for=”user_status”> Approved</label></td>
    </tr></table>

    In the same file, locate:
    wp_redirect(“user-edit.php?user_id=$user_id&updated=true”);

    Above it, add the following:

    if (isset ($_POST[‘user_status’])){
    $wpdb->query(“UPDATE $wpdb->users SET user_status = 0 WHERE ID = ‘$user_id'”);
    }else{
    $wpdb->query(“UPDATE $wpdb->users SET user_status = -1 WHERE ID = ‘$user_id'”);
    }

    That’s it. I can now moderate users from within my user administration settings.
    I bet this is darn ugly and of course a wordpress-update would break it, but it does indeed get the job done ??

    I’m a newbie to WP and PHP myself, but from looking over the docs at:

    https://codex.www.ads-software.com/Database_Description20#wp_users_-_fields

    It looks like a better place might be to use the wp_usermeta table and create a new key/value pair specifically for this usage, versus using the user_status column. I’m just not a big fan of using “depreciated” features especially if you don’t know if someone else has the same idea and you both stomp on each other.

    I’m currently looking to merge Khaan’s idea (along with my wp_metadata changes) into the James Kelly’s Themed Login Plug-in along with updating James’ plugin with the latest 2.07 fixes. This way, it will be a plugin that can survive upgrades. ??

    The caveat of this plug-in is that it appears to replicate and supplant the wp_login.php and wp_register.php files. Given this (as stated on his website), any changes to either of these files will require an upgrade to the plugin.

    Seems like a good idea, and I would myself if I had the time look into getting this to an actual plugin. If you get it running, please let us know ??

    Heh. The caveat is *IF* I get it working. The deeper I look at this and more I realize there’s no clean way to make this a plug-in. There are just a few core files that don’t have “action” events to let you override or supplement the behavior. Login, registering, user editing are some of the ones that don’t currently have “actions” associated with it. v2.1 appears to have some new ones, but still not enough to really make this a clean plug-in (e.g. does not replicate existing core code and is version agnostic).

    Honestly, it looks like this might have to remain as a “hack” to the core files as Khaan has done. The only changes I’m probably going to do with his method are:

    1. Use wp_usermeta to store the (un)approved state
    2. modify /wp-admin/users.php to add approved column and add new method under update users section.

    Once I get this figured out, I’ll post a set of instructions on how to do it. Based on my current schedule, ETA may be about 1-2 weeks from now.

    Tom Lany

    (@tomthewebmaster)

    I added this idea to the new Idea area on www.ads-software.com

    See https://www.ads-software.com/extend/ideas/topic.php?id=276&replies=1

    I urge folks to visit tomthewebmaster’s link above to lv. a supportive comment & vote for it. If you want action taken on this problem, you’ve gotta let ’em know you do!

Viewing 7 replies - 31 through 37 (of 37 total)
  • The topic ‘Registration Approval/Moderation’ is closed to new replies.