I'm using the following code to update a field value using the Formidable plug-in in Wordpress:
// Order Update Mgmt: Status
add_action('frm_after_create_entry', 'order_mgmt_status', 30, 2);
function order_mgmt_status($entry_id, $form_id){
if($form_id == 25){ //change 25 to the ID of your update form
global $wpdb, $frmdb, $frm_entry_meta;
$order_id = $_POST['item_meta'][1252]; //change 1252 to the ID of the field containing the primary key
$new_status = $_POST['item_meta'][1245]; //change 1245 to the ID of the field containing the new data to insert
$old_status = 368; //change 368 to the ID of field on the master form containing the old data
$wpdb->update($frmdb->entry_metas, array('meta_value' => $new_status), array('item_id' => $order_id, 'field_id' => $old_status));
}
}
This works perfectly with no errors.
However, if I duplicate the code it breaks my WordPress installation (white screen of death). Even though I do the following:
Any ideas for a solution would be greatly appreciated!
In that sample function, I'd add a return statement in the end:
return array( $entry_id, $form_id );
so that your following hooks have something to work with.
Other add_action hooks should look very similar:
add_action('frm_after_create_entry', 'another_order_mgmt_status', 35, 2);
function another_order_mgmt_status($entry_id, $form_id){
// do smth
return array( $entry_id, $form_id );
}