PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.3.2
Fluent Support – Helpdesk & Customer Support Ticket System v2.3.2
2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 All 67 releases
fluent-support / app / Services / ProfileInfoService.php

ProfileInfoService.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.3.2, at app/Services/ProfileInfoService.php

55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Services;
4
5 use FluentSupport\App\Models\Customer;
6
7 class ProfileInfoService
8 {
9 public static function getProfileExtraWidgets( $customer )
10 {
11 $widgets = [];
12 /*
13 * Filter customer profile widgets
14 *
15 * @since v1.0.0
16 * @param array $widgets
17 * @param object|array $customer
18 *
19 * @return void
20 */
21 $widgets = apply_filters('fluent_support/customer_extra_widgets', $widgets, $customer);
22 return $widgets;
23 }
24
25 // This method is linked with 'profile_update' action & it will trigger when user update profile
26 public function onWPProfileUpdate( $userId, $userOldData, $userUpdatedData )
27 {
28 if ( !$userId ) {
29 return false;
30 }
31
32 $customer = Customer::where( 'user_id', $userId );
33
34 if ( $customer->count() == 0 ) {
35 return false;
36 }
37
38 $keys = ['first_name', 'last_name', 'user_email'];
39 $data = [];
40
41 if( !array_diff_key( array_flip($keys), $userUpdatedData ) ) {
42 $data = [
43 'first_name' => $userUpdatedData['first_name'],
44 'last_name' => $userUpdatedData['last_name'],
45 'email' => $userUpdatedData['user_email'],
46 ];
47 };
48
49 if ( count($data) > 0 ) {
50 $customer->update($data);
51 }
52
53 }
54 }
55