Preventing duplicate bookmarks

freeman - May 6, 2007 - 16:39
Project:Click2Bookmark
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:ericdes
Status:closed
Description

Currently, it is possible to bookmark the same node multiple times.

I've created this patch to prevent the addition of a 2nd bookmark with the same path (this practically means the same node - but see below note) by the same user. The virtual key is a composite of node-path+user(uid). If there's an existing bookmark, it outputs a Drupal message to notify the user and returns to the page instead of allowing the insert.

Something to consider is if the path of the same node(nid) is changed*, it is possible to end up bookmarking the old path and the new path - where clicking the old path would end up with a 404 error (assuming no other node has taken over using that path). If we save the node->nid in the click2bookmark table, then it would allow for detecting such cases.

* Actually, I believe this itself is an issue currently as there's no hook onto the nodeapi for update or even delete. I'd be glad to look at those if there're positive reactions to my patches so far.

AttachmentSize
c2bm_prevent_duplicate.patch1.07 KB

#1

ericdes - May 11, 2007 - 10:01
Assigned to:Anonymous» ericdes

I'll use your code in the next release with the option to prevent or allow duplicate bookmarks. There's a way to delete bookmarks from the bookmark list: bookmark/view.

#2

ericdes - July 1, 2007 - 15:20
Status:needs review» closed

Done in new release. Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.