function execute_actions($type, $podname, $pieces, $is_new_item, $id) { $actions_on_pod = pods("jomiz_dms_actions", array("where" => "t.pod_name = '{$podname}' AND t.status = 'active' AND t.action_type = '{$type}'", "orderby" => "execution_order")); if ($actions_on_pod->total() > 0) { while ($actions_on_pod->fetch()) { $arguments = array(); $arguments["is_new_item"] = $is_new_item; $arguments["record_id"] = $id; $arguments["podname"] = $podname; $arguments["custom_php"] = $actions_on_pod->field("custom_php"); $arguments["stop_on_error_messages"] = $actions_on_pod->field("stop_on_error_messages"); //dms_debug::add_database_message(var_export($arguments, TRUE), "Action Found", "pods-actions"); $actions = new dms_action($arguments); $actions->perform(); } } }
if ($record_id < 0 || $record_id == "") { echo core_utilities::get_error_message("No Record"); return; } //dms_debug::add_database_message("3", "Action Exectiopn", "ACTION API PAGE"); $action_on_pod = pods("jomiz_dms_actions", array('where' => "t.id = {$action_id}")); //dms_debug::add_database_message(var_export($action_on_pod, TRUE), "Action Exectiopn", "ACTION API PAGE"); if ($action_on_pod->total() == 0) { echo core_utilities::get_error_message("The Action Is Not Registered"); return; } if (dms_data::is_record_sealed($action_on_pod->field("pod_name"), $record_id)) { // Record Is Sealed //wp_redirect($return_url); //return; } $arguments = array(); $arguments["record_id"] = $record_id; $arguments["podname"] = $action_on_pod->field("pod_name"); $arguments["built_in_action"] = ""; $arguments["built_in_parameters"] = ""; $arguments["custom_php"] = $action_on_pod->field("custom_php"); $arguments["stop_on_error_messages"] = $action_on_pod->field("stop_on_error_messages"); $action = new dms_action($arguments); $action->perform(); if ($action->go_to_url != "") { wp_redirect($action->go_to_url); } else { wp_redirect($return_url); } return;