Advertisement
drkskwlkr

Trigger FlowMattic custom action from action hook

Jun 12th, 2024 (edited)
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | Source Code | 0 0
  1. <?php
  2.  
  3. add_action('wp_insert_comment', function($comment_id, $comment) {
  4.     if ($comment->comment_type === 'review') {
  5.         $product_id = $comment->comment_post_ID;
  6.         $review_content = $comment->comment_content;
  7.         $author = $comment->comment_author;
  8.         $author_email = $comment->comment_author_email;
  9.  
  10.         do_action(
  11.             'flowmattic_trigger_workflow',
  12.             'XXXXXXXXXX', // Workflow ID generated by FlowMattic
  13.             array(
  14.                 'Product ID' => $product_id,
  15.                 'Review Text' => $review_content,
  16.                 'Author' => $author,
  17.                 'Author Email' => $author_email,
  18.             )
  19.         );
  20.     }
  21. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement