Preventing duplicate bookmarks
| Project: | Click2Bookmark |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | ericdes |
| Status: | closed |
Jump to:
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.
| Attachment | Size |
|---|---|
| c2bm_prevent_duplicate.patch | 1.07 KB |

#1
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
Done in new release. Thanks!