Guest User

cleaned up

a guest
Nov 23rd, 2016
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1.  
  2. //send a welcome email when a user account is activated
  3. add_action( 'bp_core_activated_user', 'bpdev_welcome_user_notification', 10, 3 );
  4.  
  5. function bpdev_welcome_user_notification( $user_id, $key = false, $user = false ) {
  6.  
  7.     if ( is_multisite() ) {
  8.         return ;// we don't need it for multisite
  9.     }
  10.     //send the welcome mail to user
  11.     //welcome message
  12.  
  13.     $welcome_email = __( 'Dear USER_DISPLAY_NAME,
  14.  
  15. How to retrieve the template from the other code that does not work ?
  16.  
  17. L\équipe @ SITE_NAME' );
  18.  
  19.     //get user details
  20.     $user = get_userdata( $user_id );
  21.     //get site name
  22.     $site_name = 'Your Site Name here';
  23.     //update the details in the welcome email
  24.     $welcome_email = str_replace( 'USER_DISPLAY_NAME', $user->first_name, $welcome_email );
  25.     $welcome_email = str_replace( 'SITE_NAME', $site_name, $welcome_email );
  26.     $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
  27.     $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
  28.  
  29.     //from email
  30.     $admin_email = 'contact@mysocialart.com';// get_site_option( '' );
  31.  
  32.     $from_name = $site_name . "<contact@mysocialart.com>" ;//from
  33.     $message_headers =  array(
  34.         'from'          => $from_name,
  35.         'content-type'  => 'text/plain; charset='. get_option('blog_charset')
  36.     );
  37.  
  38.     //EMAIL SUBJECT
  39.     $subject = sprintf( __( '[MySocialArt] IMPORTANT: MODE EMPLOI A LIRE %1$s ' ), $site_name ) ;
  40.     //SEND THE EMAIL
  41.     wp_mail( $user->user_email, $subject, $welcome_email, $message_headers );
  42.  
  43.     return true;
  44. }
Add Comment
Please, Sign In to add comment