You are here

function imce_mkdir_install in IMCE Mkdir 6

Same name and namespace in other branches
  1. 7 imce_mkdir.install \imce_mkdir_install()

Implementation of hook_install()

File

./imce_mkdir.install, line 6

Code

function imce_mkdir_install() {

  //update profiles. add mkdir settings.
  $profiles = variable_get('imce_profiles', array());
  foreach ($profiles as $i => $profile) {
    foreach ($profile['directories'] as $j => $directory) {
      $profiles[$i]['directories'][$j]['mkdir'] = $i == 1 ? 1 : 0;

      //user#1's profile id is 1 which must be allowed by default.
      $profiles[$i]['directories'][$j]['rmdir'] = $i == 1 ? 1 : 0;
    }
    $profiles[$i]['mkdirnum'] = $i == 1 ? 0 : 2;

    //default number of subdirectories. unlimited for user#1, 2 for others.
  }
  variable_set('imce_profiles', $profiles);

  //register custom content function
  $funcs = variable_get('imce_custom_content', array());
  $funcs['imce_mkdir_content'] = 1;
  variable_set('imce_custom_content', $funcs);

  //register custom profile process
  $funcs = variable_get('imce_custom_process', array());
  $funcs['imce_mkdir_process_profile'] = 1;
  variable_set('imce_custom_process', $funcs);
}