Trigger specific action

By: Brian Penner | Asked: 01/13/2023
ForumsCategory: Code HelpTrigger specific action
Brian Penner asked 1 year ago
Hi, Is there a way to trigger a specific action on an entry? I've got a form with a number of email actions with conditional logic to send the email at specific times. I'd like to trigger the email to resend after a while if the user doesn't update the entry. I've looked at FrmFormActionsController::trigger_actions but that seems to trigger all actions. Does anybody know of a way to trigger only a specific email? 
2 Answers
Best Answer
Rob LeVineRob LeVine answered 1 year ago
@Brian Penner - I've been asking myself this same question for a while and got sick of not having an answer.  So I figured out one way to do it and made a tutorial out of it.
Brian Penner replied 1 year ago

Thanks Rob. That is exactly what I was looking for. I found some of those functions when I was checking the Formidable Code but didn't get it all pieced together.

Rob LeVineRob LeVine replied 1 year ago

The code is "not widely tested" to say the least 🙂

Brian Penner replied 1 year ago

I trimmed this up a bit.
$entry_id = 21991; // somehow you have to set the entry id of the form entry you're dealing with
$target_action_id = 9897; // id of the action you want to fire off - you can get this from the database WP_POSTS with the post_type = 'frm_form_actions'
// or get it from the FF ui by opening the action and scrolling all the way down to the bottom right where it says "Action ID:

$entry = FrmEntry::getOne($entry_id, true);
$form_id = $entry->form_id;

$actionToDo = FrmFormAction::get_single_action_type($target_action_id, $type);

$form = FrmForm::getOne($form_id);

FrmNotification::trigger_email( $actionToDo, $entry, $form );

Rob LeVineRob LeVine replied 1 year ago

Nice! I'll update the tutorial.

Victor Font answered 1 year ago

Formidable's Form Action Automation add-on enables you to schedule emails. See this: The add-on schedules WordPress cron jobs, so execution depends upon when people visit your site, so the timing of the send is not an exact science, but close enough.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community