Advertisement
geminilabs

[site-reviews] Add custom notification tags

Sep 7th, 2021 (edited)
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. /**
  2.  * How to add notification tags for your custom fields
  3.  *
  4.  * @param array $data
  5.  * @param \GeminiLabs\SiteReviews\Modules\Email $email
  6.  * @return array
  7.  */
  8. add_filter('site-reviews/email/compose', function ($data, $email) {
  9.     $review = glsr_get($email, 'data.review');
  10.     if ($review) {
  11.         // Here you can add your own notification tags to $data['template-tags']
  12.         // $review->custom contains all of your submitted custom field values
  13.         // In the following example, the new notification tag is: {your_custom_tag}
  14.         $data['template-tags']['your_custom_tag'] = $review->custom->your_custom_field_name;
  15.     }
  16.     return $data;
  17. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement