You are here

function imce_update_profiles in IMCE 6.2

Same name and namespace in other branches
  1. 6 inc/admin.inc \imce_update_profiles()
  2. 7 inc/imce.admin.inc \imce_update_profiles()

Add, update or delete a profile.

2 calls to imce_update_profiles()
imce_profile_delete_submit in inc/imce.admin.inc
Profile delete form submit
imce_profile_submit in inc/imce.admin.inc
Profile form submit.

File

inc/imce.admin.inc, line 595
Serves administration pages of IMCE.

Code

function imce_update_profiles($pid, $profile = NULL) {
  $profiles = variable_get('imce_profiles', array());

  //add or update
  if (isset($profile)) {
    $pid = isset($profiles[$pid]) ? $pid : count($profiles) + 1;
    $profiles[$pid] = $profile;
  }
  elseif (isset($profiles[$pid]) && $pid > 1) {
    unset($profiles[$pid]);
    for ($i = $pid + 1; isset($profiles[$i]); $i++) {
      $profiles[$i - 1] = $profiles[$i];
      unset($profiles[$i]);
    }
    imce_update_roles($pid);
  }
  variable_set('imce_profiles', $profiles);
  return $pid;
}