A Cozmoslabs Product
Documentation / Profile Builder Developer Knowledge Base / Email / Email administrator after successful edit profile

Email administrator after successful edit profile

Function from this example: administrator will get an email if an user registered or edited his account.

Make sure to:

  • change email message on line 20
  • change email subject on line 18
  • remove line 5 for no mail when an user edit profile
  • remove line 6 for no mail when an user register a account

wppb_register_success is located in Profile Builder: /front-end/class-formbuilder.php

wppb_edit_profile_success is located in Profile Builder: /front-end/class-formbuilder.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Email administrator after successful edit profile. Tags: after edit profile, email administrator
 */
 
add_filter('wppb_edit_profile_success', 'wppb_email_after_edit', 10, 3);
add_filter('wppb_register_success', 'wppb_email_after_edit', 10, 3);
function wppb_email_after_edit($request, $form_name, $user_id){
   // for more information about wp_get_current_user please see http://codex.wordpress.org/Function_Reference/wp_get_current_user
   // this is useful in case you want something more then just the user_login and ID
   if ( $form_name == 'edit_profile' ){
      $user_id = get_current_user_id();
   }
 
   $user = get_user_by('id', $user_id);
   $url = admin_url("/user-edit.php?user_id=$user_id");
 
   $to = get_option( 'admin_email' );
   $subject = "User: $user->user_login successfully edited his account.";
   $message = "
<p>User: $user->user_login successfully edited or registered his account. View his account at <a href='$url'>his account</a>.</p>
   ";
   $headers = "Content-type: text/html";
 
   wp_mail($to, $subject, $message, $headers);
}

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket