You are here

function _photos_access_usersdel in Album Photos 7.3

Same name and namespace in other branches
  1. 8.5 photos_access/photos_access.module \_photos_access_usersdel()
  2. 8.4 photos_access/photos_access.module \_photos_access_usersdel()
  3. 6.0.x photos_access/photos_access.module \_photos_access_usersdel()

Delete user from album access list.

1 call to _photos_access_usersdel()
photos_access_update_access in photos_access/photos_access.module
Update access to album.

File

photos_access/photos_access.module, line 374

Code

function _photos_access_usersdel($value, $id, $type = 0) {
  if ($type) {

    // Delete all designated users.
    db_query('DELETE FROM {photos_access_user} WHERE id = :id AND collaborate = 0', array(
      ':id' => $id,
    ));
  }
  elseif (is_array($value)) {
    $count = count($value);
    $i = 0;
    foreach ($value as $key => $remove) {
      if ($remove) {
        ++$i;
        db_query('DELETE FROM {photos_access_user} WHERE id = :id AND uid = :uid', array(
          ':id' => $id,
          ':uid' => $key,
        ));
      }
    }
    if ($count == $i) {
      return TRUE;
    }
  }
}