Use the following hook implementation to add custom fields to publish step It also supports validation.
Usage:
1 | add_filter( "owf_display_publish_custom_fields", "append_custom_fields", 10, 3 ); |
Parameters:
$task_user : current task user id
$process_type : Process type i.e publish
Example:
01 02 03 04 05 06 07 08 09 10 11 12 | add_filter( "owf_display_publish_custom_fields", "append_custom_fields", 10, 3 ); function append_custom_fields( $task_user, $process_type, $html ) { if( $process_type == "publish" ) { $html = '<div class="owf-text-info left full-width"><div class="left"><label>'.__("Custom checklist: ", "oasisworkflow").'</label></div>'; $html .= '<div class="left">'; $html .= '<label><input type="checkbox" name="spellcheck" id="addtags" /> Did you run the spell check? </label>'; $html .= '<label><input type="checkbox" name="addtags" id="addcategories" />Did you add tags? </label>'; $html .= '</div></div>'; return $html; } } |

2. Validate added custom fields or add code for out of the box action / process.
Usage:
1 | add_action( 'owf_sign_off_workflow_pre', 'validate_custom_fields', 10, 2 ); |
Parameters:
$validation_result : Empty array / Array with existing validation
$sign_off_workflow_param : contains workflow publish step submitted values
Example:
1 2 3 4 5 6 7 8 9 | add_action( 'owf_sign_off_workflow_pre', 'validate_custom_fields', 10, 2 ); function validate_custom_fields( $validation_result, $sign_off_workflow_params ) { // Do validation or add out of the box action or process code. if( isset( $sign_off_workflow_params['addtags'] ) && $sign_off_workflow_params['post_tag'] < 5 ) { $validation_result = array_merge( $validation_result, array("There must be at least 5 post tags") ); } return $validation_result; } |
Didn't find what you are looking for? Submit a Query
Update Post Author After ClaimFilter Users In The Step
Update Post Author After ClaimFilter Users In The Step