You are here

function _workbench_email_filter_users in Workbench Email 7.3

Returns a list of filtered users / emails.

Parameters

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

bool $author: The author flag.

Return value

array The finalized array of permitted users.

1 call to _workbench_email_filter_users()
workbench_email_filter_users in ./workbench_email.module
Filters out the users based on criteria.

File

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

Code

function _workbench_email_filter_users($accounts, $author) {
  global $user;
  $emails = array();
  foreach ($accounts as $uid => $account) {

    // If the current user is the author and the admin has setup the
    // transition to notify them, then we force it.
    if ($author) {
      $emails[$account->mail] = $account->name;
    }

    // If the current user is a member of a separate role they
    // probably wouldn't want to be notified they just made
    // a transition. Possible setting in the future.
    if (isset($user->mail) && isset($account->mail) && $user->mail != $account->mail) {
      $emails[$account->mail] = $account->name;
    }
  }
  return $emails;
}