Moderate Signup / Restrict Registration (WPMU & BP)
-
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)
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.0\n" . "From: \"{$from_name}\" <{$admin_email}>\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:\n\n%s\n\n", '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)
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.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n"; $message = sprintf( __( "Thanks for registering! And admin will confirm your membership.\n\nYou 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.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n"; $message = sprintf( __( "New registration request from\n\nUsername: %s\n\nE-mail: %s\n\nPlease confirm by clicking the link below:\n\n%s\n\n", '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:
from Members Only <[email protected]>
to [email protected]
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:
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 (WPMU & BP)’ is closed to new replies.