You are here

function imce_update_profiles in IMCE 6

Same name and namespace in other branches
  1. 6.2 inc/imce.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/admin.inc
Profile delete form submit
imce_profile_submit in inc/admin.inc
Profile form submit.

File

inc/admin.inc, line 552

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;
  }
  else {
    if (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;
}