Skip to:
Content
Pages
Categories
Search
Top
Bottom

Moderate Signup / Restrict Registration

  • Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    WPMU 2.9.2
    BuddyPress 1.2.4

    I need admins to activate newly registered users, not the users themselves. I haven’t been able to come up with a working plugin – probably because I’ve got MU and BuddyPress both running on my “members only” site.

    I’ve modified the bp-core-signup.php file to send an e-mail to the user without the activation link and added an e-mail to the admin e-mail with the activation url. However, the user still ends up with the only e-mail, and it contains the activation url. Furthermore, the e-mail comes from noreplay@ which means that WP thinks I don’t have an admin e-mail set, which is not the case (I have one set).

    bp-core-signup.php (originally)

    Code:
    function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) {
    $activate_url = bp_get_activation_page() .”?key=$key”;
    $activate_url = clean_url( $activate_url );
    $admin_email = get_site_option( “admin_email” );

    if ( empty( $admin_email ) )
    $admin_email = ‘noreply@’ . $_SERVER['SERVER_NAME'];

    $from_name = ( ” == get_option( ‘blogname’ ) ) ? ‘BuddyPress’ : wp_specialchars( get_option( ‘blogname’ ) );
    $message_headers = “MIME-Version: 1.0n” . “From: “{$from_name}” n” . “Content-Type: text/plain; charset=”” . get_option( ‘blog_charset’ ) . “”n”;
    $message = sprintf( __( “Thanks for registering! To complete the activation of your account please click the following link:nn%snn”, ‘buddypress’ ), $activate_url );
    $subject = ‘[' . $from_name . '] ‘ . __( ‘Activate Your Account’, ‘buddypress’ );

    /* Send the message */
    $to = apply_filters( ‘bp_core_activation_signup_user_notification_to’, $user_email );
    $subject = apply_filters( ‘bp_core_activation_signup_user_notification_subject’, $subject );
    $message = apply_filters( ‘bp_core_activation_signup_user_notification_message’, $message );

    wp_mail( $to, $subject, $message, $message_headers );
    }

    bp-core-signup.php (my modification, not working)

    Code:
    function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) {
    $activate_url = bp_get_activation_page() .”?key=$key”;
    $activate_url = clean_url( $activate_url );
    $admin_email = get_site_option( “admin_email” );

    if ( empty( $admin_email ) )
    $admin_email = ‘noreply@’ . $_SERVER['SERVER_NAME'];

    /* START MOD */
    $from_name = ( ” == get_option( ‘blogname’ ) ) ? ‘BuddyPress’ : wp_specialchars( get_option( ‘blogname’ ) );
    $message_headers = “MIME-Version: 1.0n” . “From: “{$from_name}” n” . “Content-Type: text/plain; charset=”” . get_option( ‘blog_charset’ ) . “”n”;
    $message = sprintf( __( “Thanks for registering! And admin will confirm your membership.nnYou will receive a separate e-mail after this confirmation.”, ‘buddypress’ ), $activate_url );
    $subject = ‘[' . $from_name . '] ‘ . __( ‘Activate Your Account’, ‘buddypress’ );

    /* Send the message */
    $to = apply_filters( ‘bp_core_activation_signup_user_notification_to’, $user_email );
    $subject = apply_filters( ‘bp_core_activation_signup_user_notification_subject’, $subject );
    $message = apply_filters( ‘bp_core_activation_signup_user_notification_message’, $message );

    wp_mail( $to, $subject, $message, $message_headers );
    /* END MOD */

    /* START ADD */
    $from_name = ( ” == get_option( ‘blogname’ ) ) ? ‘BuddyPress’ : wp_specialchars( get_option( ‘blogname’ ) );
    $message_headers = “MIME-Version: 1.0n” . “From: “{$from_name}” n” . “Content-Type: text/plain; charset=”” . get_option( ‘blog_charset’ ) . “”n”;
    $message = sprintf( __( “New registration request fromnnUsername: %snnE-mail: %snnPlease confirm by clicking the link below:nn%snn”, ‘buddypress’ ), $user_id, $user_email, $activate_url );
    $subject = ‘[' . $from_name . '] ‘ . __( ‘Activate Your Account’, ‘buddypress’ );

    /* Send the message */
    $to = apply_filters( ‘bp_core_activation_signup_user_notification_to’, $admin_email );
    $subject = apply_filters( ‘bp_core_activation_signup_user_notification_subject’, $subject );
    $message = apply_filters( ‘bp_core_activation_signup_user_notification_message’, $message );

    wp_mail( $to, $subject, $message, $message_headers );
    /* END ADD */
    }

    So, after I submit a test registration, I get an with the information below:

    [blockquote]
    from Members Only <noreply@domain.net>
    to user@domain.com
    date Thu, Jun 3, 2010 at 3:42 AM
    subject [Members Only] Activate Your Account

    hide details 3:42 AM (3 minutes ago)

    Thanks for registering! To complete the activation of your account please click the following link:

    http://members.domain.net/activate?key=xxxxxxxxxxxxxxxx
    [/blockquote]

    Could someone help me by directing me to a plugin or some way to change my code so that I’m able to restrict registration to admin approval?

Viewing 19 replies - 1 through 19 (of 19 total)
  • Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    I guess I’ll try this:
    http://buddypress.org/community/groups/bp-registration-options/

    Not very good ratings and no support apparently.

    I will test and update.

    If anyone has any other suggestions, please reply asap. Thanks, in advance.

    Avatar of Van Murray
    Van Murray
    Participant

    @vanmurray

    @zlamczyk: I think we are trying to work on the same thing.
    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/disable-activation-email/

    I am getting spammed (bad) and they are simply using the activation email to approve themselves. My thought was just do a manual approval to either “activate”, “send activation email” or “delete from wp-signup”.

    I have modified manual member approve for BuddyPress so I can see the signup table and manually approve members.
    http://mattkern.com/wpmu-manually-approve-new-members-on-local-install/

    I just need to stop the automatic sending of the activation email. Do you know how?

    I’ve simply tried commenting out the following line in wp-core-signup.php to test, but it’s not working.
    wp_mail( $to, $subject, $message, $message_headers );

    This is the function; but for some reason the activation email still goes out.

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    @vanmurray I haven’t had time to look into this yet, but yes, your problem sounds similar to my own. I don’t necessarily want to stop the user activation e-mail all together, I just want to change the wording and remove the activation url that is sent to them. Additionally, I’d like the activation url sent to me, the administrator, so that I am the only one doing the approving of user registrations.

    I will be working on this more tonight and provide an update as I make progress. In the meantime, if anyone has suggestions…..

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    Does anyone know if I have been modifying the correct file to change where the activation e-mail is sent to:
    bp-core-signup.php

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    Decided to try bp-registration-options plugin. Flagged errors… I found the following discussion about this. It’s from 1+ month ago….

    http://bit.ly/cEVceW

    I still think that the easiest thing to do would be to simply change the activation e-mail from being sent to the user to the admin(s) instead.

    Help please!

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    I’ve searched through most of the current BuddyPress plugin files and I have yet to find anything containing activation content like bp-core-signup.php. However, after those changes I initially made I really expected it to work. How does registration using WPMU 2.9.2 and BP 1.2.4 work?

    I’m really under a time crunch and looking for some help. Thanks for hearing me out.

    Avatar of techguy
    techguy
    Participant

    @crashutah

    Since you’re using WPMU, BP just basically calls the WPMU user creation (see lines 320-321 in bp-core-signup.php). So, you’re going to have to mod the WPMU signup functionality to get the emails to send right.

    Another temp option is to try the Welcome Pack plugin which allows you to modify the activation email that users get (I haven’t tried to take the link out, but it seems possible). That would solve the email they get.

    Then, you could build a plugin to activate the users. Until then, you can just copy the activation key out of the database using phpmyadmin and browse to the URL yourself. Far from ideal, but the Flintstone way if you’re in a time crunch and need to get by until you can get a plugin.

    Avatar of techguy
    techguy
    Participant

    @crashutah

    Yep, I just tried the Welcome Pack and you can remove the link and change the email that way and it sends to the user.

    So, then you can just manually pull the activation key from the database using PhpMyAdmin or something and append it to a url like this: http://yourdomain.com/activate?key=KEY-FROM-DATABASE

    Avatar of Van Murray
    Van Murray
    Participant

    @vanmurray

    I modified the “Manual Approve” plugin by Matt Kern to work with BuddyPress (don’t think he published it to the WordPress repository). I think that may be your answer to approving manually. Just put it in mu-plugins.

    http://vanmurray.com/files/2010/06/bp-manual-member-approve.zip

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    @crashutah Yes, Welcome Pack will work that way. The extra work for me to activate is, however, annoying as you presumed.

    @vanmurray Manual Member Approve will also work. But I still have to manually send an e-mail back to the user containing their username and password. One more step that I’d like to avoid.

    Temporarily, either of those solutions will work. However, I still think that simply sending the activation e-mail/url to the admin(s) would be the best solution for me.

    I’ve got a very small extension to get this figured out how I would like. If I cannot get help, or figure it out on my own, then I’ll have to use of these two brute-force methods.

    So, still looking for help on how to get the activation e-mails sent to the admin(s) instead of the corresponding user after registration. Thanks everyone.

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    @DJPaul Any way of modifying your Welcome Pack plugin to accomplish what I want? In addition to this BuddyPress post, I’ve created on here, too:

    http://wordpress.org/support/topic/407338?replies=1

    Avatar of Zachary Lamczyk
    zlamczyk
    Participant

    @zlamczyk

    Figured this out, finally. Turns out that the file and function to modify was:
    wp-contentpluginsbuddypressbp-corebp-core-filters.php
    –>function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta )

    Isn’t it redundant to have two functions so similar to each other? Both the above function and
    wp-contentpluginsbuddypressbp-corebp-core-signup.php
    –>function bp_core_signup_send_validation_email( $user_id, $user_email, $key )
    are extraordinarily similar to each other. It’s kinda frustrating.

    I’d consider developing a plugin, but perhaps I’ll wait for the first release of WP 3.0.

    Avatar of techguy
    techguy
    Participant

    @crashutah

    Nice find Zachary. I wouldn’t recommend changing that file since it will get overwritten when you upgrade BP. Instead just use the bp_core_activation_signup_user_notification_to filter to change it to your email.

    Hi
    No, Welcome Pack won’t let you create or change which email address the activation emails are sent to.

    Avatar of marcycapron
    marcycapron
    Participant

    @marcycapron

    @zlamczyk 3 months late on this but what exactly did you do to that last snippet you posted? yes, it would get overwritten but I am in a bind just like you were. we’re doing an alumni-only social network and the email MUST be @alumni etc .edu and therefore hand approved…

    and yep, bp registration options is crap! err, doesn’t work. but, we are using wp e-commerce members only module which means that if I can just stop the user self-activating, I am pretty much good to go – (plugin requires sign up as subscription is being purchased, and it sends that damned email!!!!)

    if you happen to see this, thanks!!

    Avatar of marcycapron
    marcycapron
    Participant

    @marcycapron

    @zlamczyk and anyone else who finds this — to redirect activation email to admin….

    function my_redirect_activation_email()
    {
    return get_site_option( “admin_email” );
    }
    add_filter(‘bp_core_activation_signup_user_notification_to’, ‘my_redirect_activation_email’);

    I’m sure can be manipulated to plop user email in there.

    I cant belive there still no solution to this problem. Or is it?
    Why cant it just be a core function to BuddyPress that let us moderate signups?

    yeah, I definitely agree!!! How come there is no working solution for this BIG issue? I am already boring of removing tens of Chinese spammers and their stupid shoes, bags, other “cool cheap” stuff every day!!! There are also bloggers who wanna real blogs and real webmasters who wanna keep their network clean from those anoying spammers :/… I please you, come with a working solution and we will pray for you…thanks

    Avatar of Armin
    Armin
    Participant

    @electron88

    Why not block their emails?

Viewing 19 replies - 1 through 19 (of 19 total)

The topic ‘Moderate Signup / Restrict Registration’ is closed to new replies.