Filter Users In The Step

Description

This filter allows you to filter the available assign actors from each step.

Usage

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

Parameters

  • $users_and_process_info – array of task users or assignee, process and indication of assign to all.
  • $post_id – Id of the post.
  • $step_id – Id of the step ( Assignment, Review or Publish ).

Example

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

function filter_step_users( $users_and_process_info, $post_id, $step_id ) {
      // Create array of user ids to be filtered
      $remove_users = array( 7, 2 );
      $step_users = $users_and_process_info['users'];
      foreach( $step_users as $key=>$users ) {
         if( in_array( $users->ID, $remove_users ) ) {
		// Unset the index of array
            unset( $step_users[ $key ] );
         }
      }
      //re-index the array
      $users_and_process_info['users'] = array_values( $step_users );
      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

Hooks and FiltersAdd/Remove Inbox Column