You are here

function node_gallery_set_cover in Node Gallery 6.2

2 calls to node_gallery_set_cover()
image_delete_process in ./node_gallery.module
image_upload_process in ./node_gallery.module
We can't put this function to node_gallery.pages.inc because the batch was started after reboot.

File

./node_gallery.inc, line 261
Node gallery models

Code

function node_gallery_set_cover($gid) {
  $cover_id = db_result(db_query("SELECT nid FROM {node_galleries} WHERE is_cover > 0 AND gid = %d", $gid));
  if (empty($cover_id)) {
    $first_nid = db_result(db_query_range("SELECT nid FROM {node_galleries} WHERE gid = %d ORDER BY weight", $gid, 0, 1));
    db_query("UPDATE {node_galleries} SET is_cover = 1 WHERE nid = %d AND gid = %d", $first_nid, $gid);
  }
}