I am trying to give each organic group one folder, which I was able to do pretty nicely with the help of custom php function, but the real problem arise when an organic group owner want to re-brand there name. As of now there seems to be no functionality in IMCE by which we can show a folder name like ABC group and the underlying folder name can be content id. e.g. if Organic Group has node id of 10 and name of ABC group, it should be visible as ABC group in IMCE folders, but physical path should be like content10. Now even if a person will change the name from ABC group to DEF group all the contents and content references will stay same, but user will start looking a new name on the folder.

E.g. code which I used for getting list of folder was

function modulename_getgroupnames_user($account = NULL) {
  if (empty($account)) {
    global $user;
    $account = $user;

   $labels = array();
   $gids = og_get_groups_by_user();

   foreach ($gids as $group => $gid) {
      $group = db_select('og', 'o')
         ->fields('o', array('label'))
         ->condition('gid', $gid)
      $labels[] = "groups/".trimandlower($group->label);

   return $labels;


function trimandlower($content) {
//trim, strip excess whitespace
$content = preg_replace("/ +/", " ", trim($content));
//trim spaces
$content = str_replace(" ", "", $content);
//to lower case
$content = strtolower($content);
return $content;