WordPress Custom Email Trigger

Viewed 14

I'm using Crocoblocks/JetReviews to add reviews to my site (on a custom post type).

I can see there is a setting to require admin approval for it to be published, but I want to trigger an email to one of the admins when a review is submitted, and I don't see any settings for that so I'll have to do it myself.

I think I can handle the function to send the email, but can't sort out what to hook into or trigger it against?

Using something like this:

if ( function_exists( 'notification' ) ) :
notification( [
    'title'    => 'Admin Notification for Review Approval', // For internal reference.
    'trigger'  => 'trigger_slug', // Trigger slug (can be a Triggerable object).
    'carriers' => [ // An array with format: carrier_slug => data array
        'email' => [
            'activated'  => true, // Must be true.
            'enabled'    => true, // Must be true.
            'subject'    => 'A New Review Needs Approval', 
            'body'       => 'There is a new review awaiting your approval.',
            'recipients' => [
                [
                    'type'      => 'administrator',
                    'recipient' => 'admin@adminemail.com',
                ],
            ],
        ],
    ],
    'enabled'  => true, // Must be true.
] );
endif;

But right now that's not connected to any action...and that's where I'm lost.

Any thoughts of where to look? I couldn't figure it out from their docs so hoping someone here might have an idea of where to start at least.

Thanks!

Chad

0 Answers
Related