Title: Custom action (LearnDash)
Last modified: July 2, 2021

---

# Custom action (LearnDash)

 *  Resolved [voldh](https://wordpress.org/support/users/voldh/)
 * (@voldh)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/custom-action-learndash/)
 * Hi Ironikus, thank you very much for this great plugin!
 * I would like to trigger a webhook custom action when a user completes a course
   in LearnDash. LearnDash has the following action that fires after the course 
   is marked completed
 * `do_action( 'learndash_course_completed', array $course_data )`
 * Ref: [https://developers.learndash.com/hook/learndash_course_completed/](https://developers.learndash.com/hook/learndash_course_completed/)
 * I don’t know how to integrate this action into the webhook custom action.
 * Could you help me, please?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [voldh](https://wordpress.org/support/users/voldh/)
 * (@voldh)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/custom-action-learndash/#post-14621284)
 * Hi there!
 * I managed to solve it, it was much simpler than I imagined. I will post the solution
   here in case anyone needs it in the future.
 *     ```
       add_action(
           'learndash_course_completed',
           function ( $data ) {
   
               // ANY user completed Course 421
               if ( $data['course']->ID == 421 ) {
   
                   $custom_data = array(
                       'user_id' => $data['user']->ID
                   );
                   $webhook_names = array(
                       'user-complete-course'
                   );
                   $http_args = array(
                       'blocking' => false //Set this to true to receive the response
                   );
   
                   $response = apply_filters( 'wp_webhooks_send_to_webhook_filter', array(), $custom_data, $webhook_names, $http_args );
   
                   return '';
               }
   
           },
           20
       );
       ```
   
 * Thank you!
 *  Plugin Contributor [Ironikus](https://wordpress.org/support/users/ironikus/)
 * (@ironikus)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/custom-action-learndash/#post-14624871)
 * Hey [@voldh](https://wordpress.org/support/users/voldh/) – Thank you very much
   for your message, as well as for using our plugin.
    Glad to see you found a solution
   for your question – do reach out again in case you have any further questions,
   we are happy to help. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom action (LearnDash)’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ironikus](https://wordpress.org/support/users/ironikus/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/custom-action-learndash/#post-14624871)
 * Status: resolved