By pramudya81 on
I have a node then users may put comments on it. Ok fine. After reaching max limit of comments on one page (30 comments), the next comments would be on 2nd page and so on.
The problem is when users commenting on 2nd page (3rd, 4th, ...) users get redirected to first page of the comments! I want when users commenting on 2nd page, for example, users will be still on 2nd page (current page) and give users 'updated' page with their comments.
How to solve this?
Regards
Comments
follow up??
anyone please...?
=-=
The only thing I can think of would be to investigate the global redirect.module
You have to append current
You have to append current location in the action property of the comment form using coding in hook_form_alter()
Thus, when your user adds comment from any page, they will be redirected to the same page, only if the form is displayed in line with the comment listing and not on the next page.
:)
Beautifulmind
Know more
Regards.
🪷 Beautifulmind
No idea on your suggestion,
No idea on your suggestion, beautiful mind. Can you show how to achieve this? :)
Say url in your browser's
Say url in your browser's address bar reads: "http://www.mysite.com/node/25"
Now in one of your module files add following code.
This will redirect the page back to where it is.
And please let me know if this works for you, I have some other solutions too. ;)
:)
Beautifulmind
Know more
Regards.
🪷 Beautifulmind
No, it did not work out for
No, it did not work out for me. May be I did this wrong? I added the codes above on my comment.module.
But no works. Any other solutions, beautifulmind?
Regards
Do not alter any core module
Do not alter any core module ever.
Just make another module and put this code in it.
Beautifulmind
Regards.
🪷 Beautifulmind
Oops. Sorry didn't know
Oops. Sorry didn't know that.
However I tried this and didn't work out too.
I created new module called "fix_comment_pagination" and new file called "fix_comment_pagination.module" in it containing the codes you gave above.
NB: Putting this new module on /sites/all/modules/ then I couldn't enable this module on admin->build->modules. So I just copy this module and try to run it again. Did not work out.
Additional info:
- my nodes url : http://localhost/content/node_title
- my first page of comment on a node url : http://localhost/content/node_title?from=20&comments_per_page=10
- 2nd page url would be : http://localhost/content/node_title?page=1&from=20&comments_per_page=10
- 3rd page url would be : http://localhost/content/node_title?page=2&from=20&comments_per_page=10
and so on...
Can you help me?
Regards
Humm.... If you have created
Humm....
If you have created a module and if it doesn't work, that means there is something wrong.
Can I have full code of your module if its comply with your privacy policy? :)
:)
Beautifulmind
Regards.
🪷 Beautifulmind
Ok. I don't mind giving you
Ok. I don't mind giving you my codes. But which ones? Which modules? The comment and node modules are core modules.
While my fix_comment_pagination is exactly the codes you gave me.
Regards
One of the remedy to your
One of the remedy to your module that doesn't working is that please make sure that you have replaced the module name with that of 'hook'.
B'coz I have developed an entire project which has many things altered this way and its in single module with single 'hook' in the module that is "hook_form_alter".
If it still doesn't work, please do not hesitate to knock here :). But this time please paste all your code from the module you created.
:)
Beautifulmind
Regards.
🪷 Beautifulmind
Sorry I am not familiar with
Sorry I am not familiar with these Drupal stuffs. But I'll try :)
This is what I have for fix_comment_pagination.module on /sites/all/modules/fix_comment_pagination
Both function does not work out.
Your code reads
Your code reads like:
[code]
/*
function hook_form_alter($form_id, $form) {
if($form_id == 'node_comment_form') {
$ss__action = str_replace('//', '/', $_SERVER['REQUEST_URI']);
$form['#action'] = $ss__action;
}
}
*/
function hook_form_alter($form_id, $form) {
if($form_id == 'node_comment_form') {
$ss__destination = ($_REQUEST['destination']) ? $_REQUEST['destination'] : $_SERVER['REQUEST_URI'];
$form['#action'] = $form['#action'] .'&destination='. $ss__destination;
}
}
[/code]
Now, just replace "hook" with "fix_comment_pagination" and try following code:
:)
Beautifulmind
Regards.
🪷 Beautifulmind
Thanks for your info. But it
Thanks for your info. But it does not work neither :(
When I put a comment on 4th page, I get directed to 1st page again.
1st page here I mean 1st page of comment of a single node.
Doesn't really manners page of particular node though.
Or perhaps we misunderstood each other here?
Regards
Anyone manage to handle
Anyone manage to handle this? :)
Regards
Solution
Make a directory 'sites/all/modules/comment_pagination_fix', and put these two files in it:
comment_pagination_fix.info
and
comment_pagination_fix.module
I followed this
I followed this exactly...But no works :(
That's awefully strange.
That's awefully strange. Could you please try it on a clean install (D5, right?) just to be sure where the problem lies? And you did turn the module on, right ;-)
Yes very strange... I even
Yes very strange... I even could not make a comment after enabling this module. Yes I turn on the module.
I tried on Drupal 5.7 clean install and the problem persist.
Does it work out for you? What version you are using...
Regards
Oops, I saw I made a mistake
Oops, I saw I made a mistake when copying it. .
Do you see the 4th line of comment_pagination_fix.module:
$form['#submit'] = array('comments_pagination_fix_form_submit' => array());That should be without an 's' in 'comments', so change it to:
$form['#submit'] = array('comment_pagination_fix_form_submit' => array());Great!! It works perfectly
Great!! It works perfectly well now.
This is what I was expecting for long.
Thanks maartenvg. Maybe you should raise this issue so Drupal 6 and above could have this comment behaviour.
Regards
This has already been solved
This has already been solved in D6, as far as I can tell.
Dear marteen, Perhaps
Dear maartenvg,
Perhaps another future request would be a table to track revisions on comments.
Just like node_revisions. Thus we could give extra information to users that this node/comment has been changed by who and when.
What do you think?
I see that you are managing birthday module. I tried that module before but I never put it on my prod site. Cause I prefer to display users age on users profile rather than just option showing users DOB or not.
Hopefully this could improve birthday module anyway...
Regards
Perhaps another future
I think you should check out http://drupal.org/project/comment_revisions, it does just that :)
I'll take it into consideration. BTW you can use _birthdays_show_age($user) to implement it yourself.
Great you know much about
Great you know much about Drupal...
1. Thanks for comment revision module
2. Thanks for show_age script. I'll try this.
Regards