PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.2
Booktics – Appointment Booking Calendar for Service Businesses v1.0.2
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / core / customer / handlers / customer-event-handler.php

customer-event-handler.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.2, at core/customer/handlers/customer-event-handler.php

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Customer\Handlers;
4
5 use Booktics\Models\Customer_Model;
6
7 class Customer_Event_Handler {
8
9 /**
10 * Send invitation mail on team member creation
11 *
12 * @param $team_member_id
13 *
14 * @return bool
15 */
16 public function on_customer_create( $customer_id ) {
17 $customer = ( new Customer_Model() )->find( $customer_id );
18 $user = get_user_by( 'ID', $customer_id );
19 if ( ! $user ) {
20 return false;
21 }
22 $reset_key = get_password_reset_key( $user );
23 $reset_url = network_site_url( "wp-login.php?action=rp&key=$reset_key&login=" . rawurlencode( $user->user_login ), 'login' );
24
25 $subject = 'You’ve been invited!';
26 $message = "Hi {$customer->display_name},\n\nYou’ve been invited to join our platform.\n\n";
27 $message .= 'Reset password : ' . $reset_url . "\n";
28 $message .= 'If this wasn’t you, please ignore this email.';
29
30 $headers = array( 'Content-Type: text/plain; charset=UTF-8' );
31
32 wp_mail( $customer->email, $subject, $message, $headers );
33
34 return true;
35 }
36 }
37