skip to Main Content

Excuse me, want to ask,
I have tried to use this script in function.php:

add_action( 'user_register', 'myplugin_registration_save', 10, 1 );

And it worked
I want to retrieve the referral id data in the wp_uap_affiliates table.
But I realized that the add_action above runs before there is an insert process into the wp_uap_affiliates table, so I can’t get the referral id.

Does anyone have a solution? Thanks in advance.

2

Answers


  1. Chosen as BEST ANSWER

    Because add_action is earlier than inserting the referral id into the database, so I'm trying to find something like do_action in the Ultimate Affiliate Pro plugin script.

    Then I found this code:

    do_action('uap_on_register_action', $this->user_id);
    

    Then I use 'uap_on_register_action' to replace 'user_register' in my add_action.

    So this is the code after replace:

    add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
    

    Now it works. Thanks.


  2. I checked it’s indeed updating table after that hook. can you please give a try below code in user_register hook ?

                 sleep(3);
                 global $indeed_db;
                 $affiliate_id = $indeed_db->get_affiliate_id_by_wpuid($user_id);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search