Closed (fixed)
Project:
AJAX Comments
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Sep 2008 at 16:10 UTC
Updated:
2 Jan 2014 at 23:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
michelleWill revisit this in 2.x.
Michelle
Comment #2
v8powerage commentedI'm using ajax_comments (http://drupal.org/node/349090), but with advanced_forum "delete" function doesn't works, I created an issue #411016: Can't delete comments when using advanced_forum.module, perhaps You could take a look at this as well?
Comment #3
michelleI don't use that module and it's not something I'll have time to look at any time soon.
Michelle
Comment #4
v8powerage commentedThat's shame, because those both modules together would make a killer forum. I'm gonna try play around this, could You tell perhaps why this could be that reply works, but delete isn't? Ajax comments is using token during delete operation, maybe here's the problem, that it's lost on the way thru advanced_forum?
Comment #5
michelleAF doesn't do anything special on add/edit/delete so I really have no idea.
Michelle
Comment #6
v8powerage commentedWell I'll be trying do something about this then though I'm nobody's programmer :P
Comment #7
michelleWell, if you get it figured out, feel free to report back here. I'll look at it when I work on 2.x.
Michelle
Comment #8
v8powerage commentedI found this in ajax_comments read me
2. If you have themed your comments output, make sure that everything is wrapped to ".comment" class
in your "comment.tpl.php"
Comments doesn't works because advanced forums comment template is different and there's no "div class comment".
Comment #9
michelleAh, well, there you go, then. Sounds like you just need to add that.
Michelle
Comment #10
v8powerage commentedHi
Well it's not exactly comment class issue, because I replaced advf-forum-post.tpl.php with Drupal's default comment.tpl.php and comments still can't be deleted, they are only "fading away" but are not actually deleted, to be able to delete comments, I must disable comment theming (commenting lines) in advanced_forum.module, so it must be something in module's code, which collide with ajax_comment delete function.
Comment #11
v8powerage commentedHi
I fixed this by commenting this code in advanced_forum.module (function advanced_forum_preprocess_comment, lines 461-512):
and replacing this:
with the code below, in adfv-forum-post.tpl.php (lines 31-34):
Comment #12
michelleWell, glad you got it working but you're cutting out a large chunk of functionality to do it. Not something I recommend for users in general but great if you're happy with it. :)
Michelle
Comment #13
v8powerage commentedWell I know it's probably not the best way to do it, but I couldn't make this working in any other way. Perhaps when You'll be working on version 2.x of the module You gonna find some better solution (I'm sure You will ;-).
Comment #14
michelleHopefully. We'll see when I get that far. :)
Michelle
Comment #15
robertdjung commentedsubscribe. might give this idea some time.
Comment #16
michelleComment #17
Ingumsky commentedSubscribe...
Comment #18
tallsimon commentedi'd love to see this too, have had to turn off ajax comments for the forums :-(
Comment #19
michelleThis is not likely to get into 2.x unless someone writes a patch or an add-on to nodecomment. While 2.x will still work with normal comments, I, personally, will be using nodecomment and that's what gets my attention.
Michelle
Comment #20
apanag commentedI am going to look into this, at my free hours. I ll post later a few details about how i am going to develop it.
apanag
Comment #21
michelle@apanag: Thanks. :)
Michelle
Comment #22
apanag commentedMichelle,
nodecomment is going to be the default comment system in the advanced_forum2? Or is it going to be a plugin and the user will be able to choose either default drupal comment system or nodecomment?
apanag
Comment #23
michelleIt's optional but my focus is on nodecomment. AF will continue to work with comment but not all the features will.
Michelle
Comment #24
apanag commentedI see.
So i think the best solution is to develop a plugin for nodecomment as you suggested on post #19.
apanag
Comment #25
Roavei commentedsubscribe...
Comment #26
Drake commentedI have noticed that if Ajax Comments are enabled for forum topic, the "delete" button use the link for example:
.../comment/delete/?token=0519dc......
and this does not work becasue the comment ID is not included before ?
if I use the link
.../comment/delete/75?token=0519dc (75 states for comment ID) then the delete function works properly also in conetion with Ajax Comments...
So to solve this issue we will have to include the NID before ?
but how???
Comment #27
Ingumsky commentedYep, that's the same for me. It has been mentioned in other AF-related thread that this issue wouldn't be solved by Michelle but workaround was found by another user.
Comment #28
alex72rm commentedHi,
@#26... the problem is then with AJAX comments module integration. It isn't a problem strictly concerning advanced forum.
In fact, when I disable AJAX comments, all come back to work as desired.
Comment #29
sinn commentedI've added in advanced_forum.module in advanced_forum_preprocess_comment function after 503 line code:
This code add comment id to "href". It's from ajax_comments.module.
All my advanced_forum_preprocess_comment function
Comment #31
Fidelix commentedSubscribing.
without much hope.
Comment #32
ilw commentedSubscribing
Comment #34
mr.j commentedOk so I thought you were all wrong blaming Advanced Forum - and you were ... sort of.
Turns out fixing the bug in ajax_comments reveals another bug in advanced forum which stops it from working anyway.
Ajax Comments is lacking the $comment parameter in ajax_comments_link_alter, so the comment id and token is never going to work. It specifies $comment as the 2nd parameter to the function when it should really be $node, with $comment 3rd. Notice the watchdog log full of warning messages.
Fix for ajax_comments:
So you fix that and deletion fails anyway because advanced forum recreates the entire links array again during a preprocess function which calls hook_link_alter again after we have already altered them. And it does not pass through that same $comment parameter so the links all get the same token based on a NULL $cid which prevents deletion from working.
Fix for advanced forum (and issue):
And now comment deletion works.
Comment #35
Roavei commentedThank you for figuring this out - mr.j
I downloaded the newest AJax-Comments-Snapshot and installed it. (Your changes seem to be already implemented).
Afterwards I changed the code-line in the Advanced-Forum module. But deletion still do not work.
Do I need the newest Advanced-Forum? Actually I do use 6.x.-1.0.
Comment #36
michelle@Roavei: You should be using 1.1. 1.0 has a security issue that was copied from core forum and fixed long ago.
Michelle
Comment #37
Roavei commented@Michelle, ups... you're right... I had to catch up on various module-updates.
@mr.j
I do not know whats different now ... but now i get the following warning:
warning: Missing argument 3 for ajax_comments_link_alter() in /*/*/public_html/sites/all/modules/ajax_comments/ajax_comments.module on line 221.And yes... I did change the function in the advanced-forum.
Line 221 is:
function ajax_comments_link_alter(&$links, $node, $comment) {Comment #38
mr.j commentedThat error indicates that the function ajax_comments_link_alter is being called with only 2 arguments instead of 3.
So if you have changed the line in advanced forum then there must be somewhere else that is calling it incorrectly.
Try inserting this line right at the start of ajax_comments_link_alter:
var_dump(debug_backtrace());That should print out a backtrace of the function calls whenever ajax_comments_link_alter is called and you should be able to figure it out.
Comment #39
Roavei commentedMr. J - you're my hero ;)
Looks like we're on the right way... I am not sure about what's important in the debug_backtrace.
As suggested somewhere on the web - i also tried the following:
This prints out: "call_user_func_array" - but what does this say?
Comment #40
mr.j commentedcall_user_func_array is used to call a function using a string name. eg
call_user_func_array('function_name'). It is used all over the place in drupal for calling hook and theme implementations.You need to print the whole backtrace, not just the last function that was called.
Comment #41
rjbrown99 commentedEnclosed is a patch against DRUPAL-6--1. This incorporates the updates from #34 and also fixes a warning if arg3 isn't present.
For searchability, this also caused me the following error which is fixed by this patch:
Comment #42
rjbrown99 commentedCommitted to -dev. Marking as fixed unless I hear otherwise. Thanks.
http://drupal.org/cvs?commit=438164