You are here

function photos_access_node_validate in Album Photos 7.3

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

Implements hook_node_validate().

File

photos_access/photos_access.module, line 195

Code

function photos_access_node_validate($node, $form, &$form_state) {
  $old = isset($_SESSION['photos_access_' . $node->nid]) ? $_SESSION['photos_access_' . $node->nid] : array();
  if (isset($node->privacy['updateuser']) && !empty($node->privacy['updateuser'])) {
    $old_check = isset($old['updateuser']) ? $old['updateuser'] : array();
    if ($userdate = _photos_access_user_validate($node->privacy['updateuser'], $old_check)) {
      form_set_error('privacy][updateuser', $userdate);
    }
  }
  if (isset($node->privacy['viewid']) && $node->privacy['viewid'] == 2) {
    if (isset($node->privacy['viewuser']) && !empty($node->privacy['viewuser'])) {
      $old_check = isset($old['viewuser']) ? $old['viewuser'] : array();
      if ($userdate = _photos_access_user_validate($node->privacy['viewuser'], $old_check)) {
        form_set_error('privacy][viewuser', $userdate);
      }
    }
  }
}