/var/www/html_uk/wp-content/plugins/automatewoo/includes/Triggers/Customer_New_Account.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

if ( ! 
defined'ABSPATH' ) ) exit;

/**
 * @class Trigger_Customer_New_Account
 */
class Trigger_Customer_New_Account extends Trigger {

    public 
$supplied_data_items = [ 'customer' ];

    
/**
     * Async events required by the trigger.
     *
     * @since 4.8.0
     * @var array|string
     */
    
protected $required_async_events 'user_registered';


    function 
load_admin_details() {
        
$this->title __'Customer Account Created''automatewoo' );
        
$this->group __'Customers''automatewoo' );
    }


    function 
register_hooks() {
        if ( 
AUTOMATEWOO_DISABLE_ASYNC_CUSTOMER_NEW_ACCOUNT ) {
            
add_action'automatewoo/user_registered', [ $this'user_registered' ] );
        }
        else {
            
add_action'automatewoo/async/user_registered', [ $this'user_registered' ] );
        }
    }


    
/**
     * @param $user_id
     */
    
function user_registered$user_id ) {
        
$this->maybe_run([
            
'customer' => Customer_Factory::get_by_user_id$user_id )
        ]);
    }

}