Skip to content

Instantly share code, notes, and snippets.

@Idealien
Created February 5, 2018 11:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Idealien/1569cb052c9e1573bb8be401fb1afb76 to your computer and use it in GitHub Desktop.
Save Idealien/1569cb052c9e1573bb8be401fb1afb76 to your computer and use it in GitHub Desktop.
Gravity Flow - Conclude Workflow as Complete
<?php
add_action( 'gravityflow_workflow_complete', 'workflow_finish_complete_status', 5, 3 );
function workflow_finish_complete_status( $entry_id, $form, $final_status ) {
if ( $form['id'] == '31' ) {
if ( $final_status == 'approved' ) {
$entry = GFAPI::get_entry( $entry_id );
if ( $entry ) {
$entry['workflow_final_status'] = 'complete';
$result = GFAPI::update_entry( $entry );
gravity_flow()->log_debug( __METHOD__ . '(): Final Status cycled to complete (from approved)' );
}
}
}
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment