You are here

function workbench_email_get_all_transition_users in Workbench Email 7.3

Returns all available users for an email transition.

Parameters

mixed $data: The data being passed (form or node)

string $op: The operation (form or node)

int $rid: The role id of the transition.

array $accounts: The available users in the role.

array $editors: The Workbench Access editors array.

Return value

bool Returns a true or false array of flags.

3 calls to workbench_email_get_all_transition_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 655
Code for the Workbench Email Module.

Code

function workbench_email_get_all_transition_users($data, $op, $rid, &$accounts = array(), &$editors = array()) {
  $author = FALSE;
  $workbench_access_enabled = FALSE;
  $section_selected = FALSE;
  $workbench_access_configured = FALSE;

  // Load available users for given role.
  if ($rid == WORKBENCH_EMAIL_AUTHOR) {
    if ($op == 'form') {
      $account = user_load($data['form_state']['node']->uid);
    }
    else {
      $account = user_load($data->uid);
    }
    $accounts[$account->uid] = $account;
    $author = TRUE;
  }
  else {
    $accounts = workbench_email_get_users($rid);
  }
  if (module_exists('workbench_access')) {
    $workbench_access_enabled = TRUE;
    $workbench_access_configured = workbench_email_validate_workbench_access_configuration($op, array(
      'data' => $data,
    ));
    if ($workbench_access_configured) {
      $sections = workbench_email_get_workbench_access_sections($op, array(
        'data' => $data,
      ));
      if ($sections) {
        $section_selected = TRUE;
        $editors = workbench_email_get_workbench_access_editors($rid, $sections);
      }
    }
  }
  return array(
    'author' => $author,
    'workbench_access_enabled' => $workbench_access_enabled,
    'section_selected' => $section_selected,
    'workbench_access_configured' => $workbench_access_configured,
  );
}