Adding Custom Fields to Publish Step

Use the following hook implementation to add custom fields to publish step It also supports validation.

Usage:

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:

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"&gt;<div class="left"&gt;<label&gt;'.__("Custom checklist: ", "oasisworkflow").'</label&gt;</div&gt;';
      $html .= '<div class="left"&gt;';
      $html .= '<label&gt;<input type="checkbox" name="spellcheck" id="addtags" /&gt; Did you run the spell check? </label&gt;';
      $html .= '<label&gt;<input type="checkbox" name="addtags" id="addcategories" /&gt;Did you add tags? </label&gt;';
      $html .= '</div&gt;</div&gt;';
      return $html;
   } 
}
custom attributes on the last step

2. Validate added custom fields or add code for out of the box action / process.

Usage:

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:

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'] ) &amp;&amp;  $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

Hooks and FiltersUpdate Post Author After Claim