I am using AJAX Comments to post and edit comments on the same page. However, when I try to delete a comment with the Comment Goodness module, I am being redirected to a new page.
Therefore, I would like to be able to either bypass the confirmation you get when you try to delete a comment, and delete it right away, on the same page, or be able to get the confirmation form with AJAX.
I think the first one is much easier and only requires some deletion of code in the module. However, I haven't managed to do it yet, I'm trying though, but it would be nice if someone could help me with it.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | alter_comment_delete_menu_for_delete_own-1907222-9.patch | 3.3 KB | formatC'vt |
Comments
Comment #1
formatC'vt commentedThis is a bug on ajax_comments module side, a this bug is fixed in latest dev
Comment #2
Ayran commentedHi, I have latest ajax_comments dev and latest comment goodness dev, but AJAX is not working when user wants to delete own comment - goes to new page with confirmation.
Comment #3
chrislabeard commentedI also have the latest of both ajax comments and comments goodness installed, and the delete link takes me to another page instead of firing via ajax.
Any updates on this?
Comment #4
formatC'vt commentedI'll try to reproduce this bug on this week
Comment #5
formatC'vt commentedI think this bug should be fixed on Comment goodness module side. By altering existing menu element:
not by adding new one
Comment #6
msypes commentedI'm also trying to get this sort of behavior. I checked out Comment Goodness, but also didn't like that it uses a different location, as mentioned in #5. I've put together simple hook_menu_alter that works as far as access is continued, but whether or not that custom module is activated, I'm getting strange behavior. Maybe someone can guide in how Ajax Comments might be affecting the process flow, if at all.
I have a view of nodes that includes their comments with delete links. Clicking delete brings me to the delete confirm page, as expected, although I, too, would love for this to just bring up a confirm dialog. (Maybe I just need to figure out how to AJAXify that form?)
What I haven't been able to do is get a redirect back to the view page after comment deletion, either with code or Rules. In fact even deleting from a regular content page doesn't take me back there either. Is there something in this module that could do that, or should I be focusing on my own crappy code?
Comment #7
formatC'vt commentedcan you provide that simple
hook_menu_altercode you made?AJAX Comments AJAXify links(forms) in
ajax_comments_comment_viewComment #8
msypes commentedHere you go:
The above only solved part of the problem, as Views' built-in comment delete link handler has a hard-coded access method. So, I made a custom one in the same module, by duplicating, renaming, and modifying the original:
I also completed my solution to all these problems by including some Javascript to override the usual call of these links (formatted as php here merely for convenience):
Finally, I have a couple of Rules to redirect back to the appropriate page when a comment is deleted, and
hook_form_alterfor the Cancel link:I have an empty
DIVin mypage.tpl.php, to hold the incoming delete confirmation form, or whatever I may need in the future.The end result of all these bits and pieces is that authenticated comment authors, as well as traditional admin roles, can delete comments. The links bring up a little modal box. Clicking "Cancel" makes it go away. Clicking the "Delete" button reloads the page with the comment gone. (The only thing that would make this slicker, IMO, would be to avoid the page refresh, but I've got other fish to fry at the moment.)
I also suggest moving this back to the AJAX Comments Issue Queue. I agree that Comment Goodness' solution is improper, but, as this is a feature request that could be rolled entirely into AJAX Comments, and Comment Goodness could be dispensed with entirely, it strikes me as a more logical placement.
Comment #9
formatC'vt commentedImplemented altering existing menu element.
Comment #10
socialnicheguru commentedthis worked perfectly.
Comment #11
mudasirweb commented#9, Finally worked. Thanks @formatC'vt