Custom webhook multiple result
-
Hello,
i am currently trying to create an individual custom webhook, which is connected to Integromat.
The trigger is triggered when the role of the user is changed in the backend of WordPress. At the moment everything works fine, but I have the problem if several user roles are changed at once. As a result I only get the last record of the user. What is the best way to proceed here so that I get all records of the users.Here is my code:
add_action( ‘set_user_role’, ‘setUserRoleTrigger_init’, 10, 2 );
function setUserRoleTrigger_init(){
WPWHPRO()->delay->add_post_delayed_trigger(‘setUserRoleTrigger’, func_get_args() );
}
function setUserRoleTrigger( $user_id, $old_user_data ) {
$user_data = (array) get_user_by( ‘id’, $user_id );
$user_data[‘user_meta’] = get_user_meta( $user_id );
$user_data[‘user_old_data’] = $old_data;do_action(‘wp_webhooks_send_to_webhook’,$user_data);
}Thanks,
Aykut1907
The topic ‘Custom webhook multiple result’ is closed to new replies.