Title: Custom webhook multiple result
Last modified: May 14, 2020

---

# Custom webhook multiple result

 *  Resolved [aykut1907](https://wordpress.org/support/users/aykut1907/)
 * (@aykut1907)
 * [6 years ago](https://wordpress.org/support/topic/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
    -  This topic was modified 6 years ago by [aykut1907](https://wordpress.org/support/users/aykut1907/).

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Ironikus](https://wordpress.org/support/users/ironikus/)
 * (@ironikus)
 * [6 years ago](https://wordpress.org/support/topic/custom-webhook-multiple-result/#post-12836580)
 * Hey [@aykut1907](https://wordpress.org/support/users/aykut1907/) – thank you 
   a lot for your message.
    I’m afraid this is out of our scope since it is only
   about customizing something instead of really fixing an issue within our plugin.
 * Apart from that, I’m still happy to give you some further guidance on what you
   can do 🙂
 * The set user role only fires on the main role of the user. Since you add multiple
   roles, the other ones are additional and are usually added using the $user->add_role()
   function.
 * You, therefore, should also use the **add_user_role** hook. Further details on
   this one is available here: [https://developer.wordpress.org/reference/hooks/add_user_role/](https://developer.wordpress.org/reference/hooks/add_user_role/)
 * Hope this helps!
    If you have further questions, please let me know. 🙂

Viewing 1 replies (of 1 total)

The topic ‘Custom webhook multiple result’ is closed to new replies.

 * ![](https://ps.w.org/wp-webhooks/assets/icon-256x256.jpg?rev=2656397)
 * [WP Webhooks - Automate repetitive tasks by creating powerful automation workflows directly within WordPress](https://wordpress.org/plugins/wp-webhooks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-webhooks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-webhooks/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-webhooks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-webhooks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-webhooks/reviews/)

## Tags

 * [users](https://wordpress.org/support/topic-tag/users/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ironikus](https://wordpress.org/support/users/ironikus/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/custom-webhook-multiple-result/#post-12836580)
 * Status: resolved