Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
comment.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2007 at 12:27 UTC
Updated:
4 Apr 2012 at 09:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
catchOK, so as with this patch this code isn't mine, I've just rolled it into a patch against HEAD.
It adds a new function comment_last_page($nid) to comment.module and changes the behaviour of comment_form_submit to display the just posted comment, instead of the original node.
This is working great on my 5.1 install. Not tested against HEAD yet so please review!
Comment #2
dries commentedIn various cases, this won't be possible -- for example, when the comment ends up in the moderation queue. From the looks, your patch doesn't take this into account.
Comment #3
catchNo it doesn't and that's a good point - never had comment moderation switched on so it didn't cross my mind.
Here's another idea but it's a bit more serious - permalinks for comments:
If I edit a comment, it takes me to example.com/comment/edit/123 - how about doing the following?
example.com/comment/123 displays the individual comment on it's own page - the comment shows up whether in moderation or not (because moderation isn't access control).
Page also has a breadcrumb back to the parent node.
If the comment is published, then you also get a "view this comment in context" link on that page - due to differing comment display settings this would require Comment links don't work if comment is not present on first page of pager. to be resolved as well.
comment submit redirects to the comment permalink either way - or maybe a switch on moderation settings to go to the "in context" link if moderation is off.
This would allow users to see their comments after they're published, and it'd also mimic the functionality of of some standalone forums in terms of being able to link to and display individual comments.
Caveat, this is beyond my rudimentary php so it's just a suggestion at this point.
Comment #4
xanoI was just trying to make/find some permalink thing for comments when I encountered this page. Permalinks for nodes can already be made by creating a link to /node/[nid], but this won't work for comments as they're no nodes. It would be cool if they would be created as 'nodes' as well, so one could easily point to /comment/[comment-id]#[comment-id]. In this case Drupal will have to look up to which node the comment is hooked, and load the proper page. The target thing in the url (#[comment-id], I don't exactly know how it's called) and a slight moderation of comment.tpl.php (to create the anchors) will do the rest.
Comment #5
catchtenrapid suggested this on http://drupal.org/node/6162#comment-98014
Comment #6
catchNew module does permalinks for comments:
http://drupal.org/project/comment_page
haven't tried it yet, but in case anyone else finds this issue whilst looking for the same thing.
Comment #7
catchComment #8
catchmarking as duplicate of: http://drupal.org/node/177652
Comment #9
catchComment #10
catchhttp://drupal.org/node/187391 is newer, but leaving this as duplicate.
Comment #11
purabdk commentedI solved the issue using following code. you can put following code in your module.
function modulename_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'comment_form') {
$form['#action'] = request_uri();
$form['#submit'][] = 'noredirect_comment_form_submit';
}
}
/**
* Implementation of hook_comment_form_submit().
*/
function comment_no_redirect_comment_form_submit(&$form, &$form_state) {
$form_state['redirect'] = ltrim($form['#action'], '/');
}