You are here

function elfinder_get_user_profile in elFinder file manager 8.2

Same name and namespace in other branches
  1. 6.2 elfinder.module \elfinder_get_user_profile()
  2. 7.3 elfinder.module \elfinder_get_user_profile()
  3. 7.2 elfinder.module \elfinder_get_user_profile()
3 calls to elfinder_get_user_profile()
elFinderConnectorController::getConnector in src/Controller/elFinderConnectorController.php
File browser to filesystem php connector service
elfinder_editor_upload_ckeditor in editors/ckeditor/ckeditor.upload.inc
@file
elfinder_editor_upload_fckeditor in editors/fckeditor/fckeditor.upload.inc
@file

File

./elfinder.module, line 73

Code

function elfinder_get_user_profile() {
  $profiles = entity_load_multiple('elfinder_profile');
  $first_profile = NULL;
  $rids = elfinder_user_roles();

  // $rids[] = 1; // anonymous user

  /* Get first matching profile for higest weight user role */
  foreach ($rids as $rid) {
    foreach ($profiles as $profile) {
      if (in_array($rid, $profile
        ->getConf('roles')) or in_array('anonymous', $profile
        ->getConf('roles'))) {
        if (is_null($first_profile)) {
          $first_profile = $profile;
        }
        else {
          if (isset($profile->settings['volume'])) {

            /* Adding all available to current user volumes from other profiles */

            /* foreach ($profile->settings['volume'] as $volume) {
                 $first_profile->settings['volume'][] = $volume;
               }*/
          }
        }
      }
    }
  }
  return $first_profile;
}