Allow to omit delete confirmations
| Project: | Guestbook |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi,
I'm loving this module (put it on my profile page's) but I only have one need to enhance the user experience for my site. I need to remove the functionality of the delete confirmation (IE. When one clicks delete on a guestbook entry it brings them to the confirm page- "are you sure?") I'd like to make it more like facebook's wall so that one wouldn't have to confirm a delete (it's sort of redundant which is something I don't really want on my site.)
I looked at the module code, and it seems that the changes would only need to be made to this one section (http://pastie.textmate.org/235261) but when I do attempt to modify it to remove the confirmation, it brakes the module..
IS there anyway to do what I'm attempting to do, any suggestions please?
Thanks.
Jon.

#1
Hey Jon I'm also looking into this. So far I'm able to skip the confirmation however I just get redirected to a blank page. I'm starting to think that we might have to rewrite the function. or combine them. I'll let you know if I make any progress in this although it will be nothing more then a sloppy hack...
#2
What happens if a user clicks accidentally on the 'delete' link?
#3
Sun good question, however for my needs making that mistake won't be a big deal. I just want everything on my site to be from point A to point B. But I'm sure that guestbook entries will get deleted by mistake every now and then but like I said before for my needs the guestbook is nothing more then a nice additional feature thats appears as a block in the users profile.
#4
I would be open to review + commit a patch that turns this into a module setting.
#5
Thanks everyone.. I've been able to get as far as when the user clicks delete, it redirects them to a blank page also.. I also believe we may have to write our own little hack to be able to do this.. :S
I'm going to watch this subject closely, because I think it would be so cool to omit confimation, and enhance the user experience immensely.. go from point A to B as Walker2238 said.
Jon.
#6
So instead of actually trying to make this work I've been thinking about it... Which made me think of a possible alternative that might make everyone happy. I was playing around witht he private msg module and when a user deletes their private messages a pop up box displays a warning that says "are you sure you want to delete this message?" confirm or deny... blah blah blah... anyways you get the idea just thought something like that would be perfect for this module...
So since I came up with the idea, who's going to do it for me? haha
Just joking around. Any thoughts?
#7
OK so I started trying to make this work and so far all I've really done is delete all delete functions and replace this part from theme_guestbook_entry function.
<?php// links
if (_guestbook_access('administer', $uid) && !$confirm_delete) {
if ($comment_entry != $entry['id']) {
$pager = $_GET['page'] ? 'page='. $_GET['page'] : NULL;
$output .= '<div class="links">» ';
$output .= l(t('Delete entry'), "guestbook/$uid/delete/{$entry['id']}", array(), $pager) .' | ';
$output .= l($entry['comment'] == '' ? t('Add comment') : t('Edit comment'), "guestbook/$uid/comment/{$entry['id']}", array(), $pager, 'comment-entry');
$output .= '</div>';
}
}
?>
With this, which adds the onclick confirm message and redirects the user back to their profile page, or atleast it seems to be doing that.
<?php
// links
if (_guestbook_access('administer', $uid)) {
if ($comment_entry != $entry['id']) {
$links['guestbook_delete'] = array('title' => t('Delete entry'), 'href' => "user/$uid", 'attributes' => array('onclick' => "return confirm('". t('Are you sure to delete this entry?') ."')"));
$pager = $_GET['page'] ? 'page='. $_GET['page'] : NULL;
$output .= '<div class="links-delete">';
$output .= theme('links', $links);
$output .= l($entry['comment'] == '' ? t('Add comment') : t('Edit comment'), "guestbook/$uid/comment/{$entry['id']}", array(), $pager, 'comment-entry');
$output .= '</div>';
}
}
?>
Sun by now I assume your are the maintainer of this module so feel free to jump in whenever to tell me to stop and start over as I've only started learning PHP in the past month or so.
#8
Well, in Drupal 6 you can get modal dialogs for confirmation pages very easy by installing http://drupal.org/project/popups
For Drupal 5, there is no such module (AFAIK, that is).
Hence, as mentioned before, I would likely accept a patch that turns this into a module setting. Administrators that want to disable confirmation pages would then be able to do this, but should be warned about possible implications.
#9
Well I hate to say it but I give up. I have not Idea what I'm doing. Good luck to the next guy.
#10
Hmm, darn.. I'm not much of a programmer in this field of things so I'm not sure how far I'll get trying to solve this
Thanks everyone for your responses.
Jon.