You are here

function bueditor_user_eids in BUEditor 6

Same name and namespace in other branches
  1. 6.2 bueditor.inc \bueditor_user_eids()
  2. 7 bueditor.inc \bueditor_user_eids()

Return the editor ids assigned to the user.

1 call to bueditor_user_eids()
bueditor_textarea in ./bueditor.module
Integrate the editor into textareas.

File

./bueditor.module, line 210

Code

function bueditor_user_eids($user) {

  //user #1
  if ($user->uid == 1) {
    return array(
      variable_get('bueditor_user1', 1),
      variable_get('bueditor_user1_alt', 0),
    );
  }
  $roles = variable_get('bueditor_roles', array());

  //anonymous user
  if (!$user->uid) {
    return array(
      $roles[DRUPAL_ANONYMOUS_RID]['editor'],
      $roles[DRUPAL_ANONYMOUS_RID]['alt'],
    );
  }

  //other users
  foreach ($roles as $rid => $role) {
    if (isset($user->roles[$rid])) {
      return array(
        $role['editor'],
        $role['alt'],
      );
    }
  }
}