Restricting Self-Review

Description

The action filter is executed when displaying a list of available assignees during sign off.

Use this filter add/remove any users from the assignee list. For example, if you want to restrict self review, you can remove the current user ID from the list of available assignees.

Usage

add_filter( 'owf_get_users_in_step', 'customize_step_user_list', 10, 3 );

Parameters

  • $users_and_process_info – Array of available assignees and process information.
  • $post_id – ID of the post.
  • $step_id – ID of the workflow step.

Example

add_filter( 'owf_get_users_in_step', 'customize_step_user_list', 10, 3 );

function customize_step_user_list($users_and_process_info, $post_id, $step_id) {

   $new_assignees = array();

   // get the users for the given step
   $current_assignees = $users_and_process_info['users'];

   // no self-review
   foreach( $current_assignees as $key => $user ){
      if ($user->ID != get_current_user_id() ) {
         array_push( $new_assignees, $user );
      }
   }

   //replace the 'users' key with the new set of assignees
   $users_and_process_info['users'] = $new_assignees;

   return $users_and_process_info;
}

Source Code

The filter is located in class-ow-process-flow.php

Didn't find what you are looking for? Submit a Query

Redirect After Workflow SubmitPre-Claim Filter