You are here

function filedepot_og in filedepot 6

Same name and namespace in other branches
  1. 7 filedepot.module \filedepot_og()

File

./filedepot.module, line 1247
filedepot.module Filedepot: File Management Module developed by Nextide www.nextide.ca Full featured document managment module with a desktop application feel. Integrated role and user permissions to secure folders, automated notifications, Tag Cloud…

Code

function filedepot_og($op, $gid, $uid, $args) {
  $modified = FALSE;
  if (!empty($uid) and !empty($gid)) {
    switch ($op) {
      case 'user insert':
      case 'user update':
        if (isset($args['is_active']) && $args['is_active']) {
          $modified = TRUE;
        }
        break;
      case 'user delete':
        $resfolders = db_query("SELECT catid as cid FROM {filedepot_access} WHERE permtype='group' and permid=%d AND view=1", $gid);

        /* foreach folder the user had access to via the group permission - remove from the recent folders */
        while ($A = db_fetch_array($resfolders)) {
          db_query("DELETE FROM {filedepot_recentfolders} WHERE cid=%d AND uid=%d", $A['cid'], $uid);
        }
        $modified = TRUE;
        break;
    }
    if ($modified) {

      // Clear the cached user folder permissions
      db_query("UPDATE {filedepot_usersettings} set allowable_view_folders = '' WHERE uid=%d", $uid);
    }
  }
}