You are here

function workbench_email_filter_users in Workbench Email 7.3

Filters out the users based on criteria.

Parameters

int $rid: The role id.

array $accounts: The available users under a given role.

array $editors: The available Workbench Access editors.

array $flags: The array of flags for author and workbench access.

Return value

array The finalized array of permitted users (email / name).

3 calls to workbench_email_filter_users()
workbench_email_form_node_form_alter in ./workbench_email.form.inc
Implements hook_form_BASE_FORM_ID_alter().
workbench_email_notification_submit in ./workbench_email.form.inc
Submit handler for the workbench_email form element.
workbench_email_workbench_moderation_transition in ./workbench_email.module
Implements hook_workbench_moderation_transition().

File

./workbench_email.module, line 762
Code for the Workbench Email Module.

Code

function workbench_email_filter_users($rid, $accounts = array(), $editors = array(), $flags = array()) {
  $emails = array();
  if ($flags['workbench_access_enabled'] && $flags['workbench_access_configured']) {
    if ($editors && $accounts && !$flags['author']) {
      $emails = workbench_email_filter_workbench_access_users($rid, $accounts, $editors, $flags['author']);
    }
    elseif ($accounts && $flags['author'] && $flags['section_selected']) {
      $emails = _workbench_email_filter_users($accounts, $flags['author']);
    }
  }
  else {
    if ($accounts) {
      $emails = _workbench_email_filter_users($accounts, $flags['author']);
    }
  }
  return $emails;
}