Paypal Add-on (Customization) - Send 'Pending' Orders to Paypal Upon Update

Est. Reading: 1 minute
By: pagerank
Created: 03/18/2017
Category:
Difficulty: Advanced

Paypal Add-on (Customization) - Send 'Pending' Orders to Paypal Upon Update

×Warning: This tutorial was created 2613 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

I created this little hack that might prove useful for others:

add_action('frm_after_update_entry', 'after_entry_updated', 50, 2);
function after_entry_updated($entry_id, $form_id){
global $wpdb;
$status = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}frm_fields WHERE field_key='abcdefg'"); // Replace abcdefg with your status field key
$publish = FrmProEntriesController::get_field_value_shortcode(array('field_id' => $status, 'entry_id' => $entry_id));
if ( $form_id == 123 && $publish == 'pending' ) {//Replace 123 with your form ID
FrmFormActionsController::trigger_actions( 'create', $form_id, $entry_id, 'paypal' );
add_action('frm_after_update_entry', 'FrmPaymentsController::redirect_for_payment', 51, 2);
}
}

On my form, the Submit Button includes the price in the custom HTML.  If someone submits a form, but doesn't pay, the button shows 'Update' when editing the form. It would be great if someone could add to this script so the Submit Button only shows 'Update' only after payment is made.

Update: This script appears to have stopped working since the last round of WP core and plugin updates. Does anyone see anything that would have changed recently and should be updated in the script above?

Leave a Reply

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
crosschevron-leftchevron-rightarrow-right