This module seems to be missing a nodeapi hook for when nodes are deleted. Not having this in could create a lot of orphan records when nodes are deleted.

Looking at this patch http://drupal.org/node/81010
If you had to remove all the extra theming functionality this is all that will be left. I really think this should be added to the current releases.

/**
 * Implementation of hook_nodeapi().
 */
function views_bookmark_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) { 
    // Delete all bookmarks for this node when node is deleted
    case 'delete':
      db_query("DELETE FROM {views_bookmark_nodes} WHERE nid = %d", $node->nid);
      break;
  } 
}

And I think this would make it 5.x compliant as the above is for 4.7. (note the 5.x code is untested)

/**
 * Implementation of hook_nodeapi().
 */
function views_bookmark_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
  switch ($op) { 
    // Delete all bookmarks for this node when node is deleted
    case 'delete':
      db_query("DELETE FROM {views_bookmark_nodes} WHERE nid = %d", $node->nid);
      db_query("DELETE FROM {views_bookmark_node_count} WHERE nid = %d", $node->nid);
      break;
  } 
}

Comments

quicksketch’s picture

Status: Active » Fixed

Thanks! Committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)