function filedepot_og in filedepot 7
Same name and namespace in other branches
- 6 filedepot.module \filedepot_og()
File
- ./
filedepot.module, line 2077 - filedepot.module Filedepot: File Management Module developed by Nextide www.nextide.ca Full featured document managment module with a desktop application feel. Integrated Organic Group, Role and User permissions to secure folders, automated…
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=:gid AND view=1", array(
':gid' => $gid,
));
/* foreach folder the user had access to via the group permission - remove from the recent folders */
while ($A = $resfolders
->fetchAssoc()) {
db_query("DELETE FROM {filedepot_recentfolders} WHERE cid=:cid AND uid=:uid", array(
':cid' => $A['cid'],
':uid' => $uid,
));
}
$modified = TRUE;
break;
}
if ($modified) {
// Clear the cached user folder permissions
db_query("UPDATE {filedepot_usersettings} set allowable_view_folders = '' WHERE uid=:uid", array(
':uid' => $uid,
));
}
}
}