You are here

function photos_edit_cover in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.edit.inc \photos_edit_cover()
1 string reference to 'photos_edit_cover'
photos_menu in ./photos.module

File

inc/photos.edit.inc, line 368

Code

function photos_edit_cover($node, $fid) {
  $pid = db_result(db_query('SELECT pid FROM {x_image} WHERE fid = %d', $fid));
  if ($pid == $node->nid) {
    db_query('UPDATE {x_album} SET fid = %d WHERE pid = %d', $fid, $node->nid);
    drupal_set_message(t('Cover successfully set.'));
    $goto = $_GET['destination'] ? $_GET['destination'] : "node/{$node->nid}/photos";
    return drupal_goto($goto);
  }
  else {
    drupal_not_found();
  }
}