Does anyone know how to get a welcome email in BP 1.1.3 without resorting to the Welcome Pack plugin?
There are some clues here, but I have no idea what to do with them and if this would even apply to Buddypress registration process.
Should I just stick this in a template files somewhere? Where?
<?php wpmu_welcome_user_notification($user_id, $password, $meta); ?>
Would it take the text from the Options in the admin area?
Or does BP have its own function for this?
Found this in bp_core_activation.php:
/***
* bp_core_disable_welcome_email()
*
* Since the user now chooses their password, sending it over clear-text to an
* email address is no longer necessary. It's also a terrible idea security wise.
*
* This will only disable the email if a custom registration template is being used.
*/
function bp_core_disable_welcome_email() {
if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
return true;
return false;
}
add_filter( 'wpmu_welcome_user_notification', 'bp_core_disable_welcome_email' );
So I guess I could just remove this function?
Is sending that password really such a “terrible idea security wise”? Are criminal gangs intercepting these emails to break into WordPress accounts?
EDIT: Yes, removing that function works. A regular WPMU welcome email is sent.
But the password in the email is eight numbers instead of the eight letters password I’d entered. Why?! Does Buddypress do its own encryption on the password? Does it use other tags or “placeholders” or whatever they’re called to call the password?
Going to sit in a corner and cry…
The welcome email is generated by this function in wpmu-functions.php:
function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
global $current_site;
if( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
return false;
$welcome_email = get_site_option( 'welcome_user_email' );
$user = new WP_User($user_id);
$fullname = $meta[field_1];
$welcome_email = apply_filters( "update_welcome_user_email", $welcome_email, $user_id, $password, $meta);
$welcome_email = str_replace( "FULLNAME", $fullname, $welcome_email );
$welcome_email = str_replace( "SITE_NAME", $current_site->site_name, $welcome_email );
$welcome_email = str_replace( "USERNAME", $user->user_login, $welcome_email );
$welcome_email = str_replace( "PASSWORD", $password, $welcome_email );
$welcome_email = str_replace( "LOGINLINK", wp_login_url(), $welcome_email );
...
I’ve added the FULLNAME lines. It works if used in the welcome email text in the wp-admin options.
But haven’t figured out how to get the right password…
Is there a way to put this customized function in bp-custom.php? And let the system use that one instead of the original in wpmu-functions.php? Forgot how that worked.