Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //send a welcome email when a user account is activated
- add_action( 'bp_core_activated_user', 'bpdev_welcome_user_notification', 10, 3 );
- function bpdev_welcome_user_notification( $user_id, $key = false, $user = false ) {
- if ( is_multisite() ) {
- return ;// we don't need it for multisite
- }
- //send the welcome mail to user
- //welcome message
- $welcome_email = __( 'Dear USER_DISPLAY_NAME,
- How to retrieve the template from the other code that does not work ?
- L\équipe @ SITE_NAME' );
- //get user details
- $user = get_userdata( $user_id );
- //get site name
- $site_name = 'Your Site Name here';
- //update the details in the welcome email
- $welcome_email = str_replace( 'USER_DISPLAY_NAME', $user->first_name, $welcome_email );
- $welcome_email = str_replace( 'SITE_NAME', $site_name, $welcome_email );
- $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
- $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
- //from email
- $admin_email = 'contact@mysocialart.com';// get_site_option( '' );
- $from_name = $site_name . "<contact@mysocialart.com>" ;//from
- $message_headers = array(
- 'from' => $from_name,
- 'content-type' => 'text/plain; charset='. get_option('blog_charset')
- );
- //EMAIL SUBJECT
- $subject = sprintf( __( '[MySocialArt] IMPORTANT: MODE EMPLOI A LIRE %1$s ' ), $site_name ) ;
- //SEND THE EMAIL
- wp_mail( $user->user_email, $subject, $welcome_email, $message_headers );
- return true;
- }
Add Comment
Please, Sign In to add comment