0

The File Browser link is different for each user, e.g.:

http://example.com/user/1/imce
http://example.com/user/10/imce

How can I create a shortcut to the File Browser which is good for all users?

1

Use me aliases module.

It turns:

http://example.com/user/10/imce

to:

http://example.com/user/me/imce
0

This is default page provided by IMCE module, you can create your own menu callback which will call same page callback which is used by "user/[UID]/imce". To do this you can use hook_menu. Once you've done that, if required you can remove access to default page using hook_menu_alter.

Here is example of how you can achieve this:

function MODULENAME_menu() {
  $items['custom-imce'] = array(
    'title' => 'File browser',
    'page callback' => 'MODULENAMW_imce_user_page',
    'access callback' => 'MODULENAMW_imce_user_page_access',
  );

  return $items;
}

function MODULENAMW_imce_user_page() {
  global $user;

  if (!empty($user->uid)) {
    module_load_include('inc', 'imce', 'inc/imce.page');
    imce_user_page($user);
  }
  else {
    drupal_set_message(t('Please login to access this page.'), 'warning');
    drupal_goto('');
  }
}

function MODULENAMW_imce_user_page_access() {
  global $user;

  if (!empty($user->uid)) {
    return imce_user_page_access($user);
  }

  return FALSE;
}
0

For the current user /imce path should work:

http://example.com/imce

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.