Moderate Signup / Restrict Registration
-
WPMU 2.9.2
BuddyPress 1.2.4I 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 Accounthide 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?
- The topic ‘Moderate Signup / Restrict Registration’ is closed to new replies.