hi,
i am using AJAX Comments 6.x-1.x-dev & Node and Comments Form Settings 6.x-1.x-dev

please see screenshots..
at '0 ajax comments.png' is my ajax settings

at '1 comment settings.png' is my comment settings

at '2 node form settings.png' is my node form settings

now when open the page & create a new comment, all works well (see '3 comment.png')
but as i edit my previous comment it shows me (see '4 edit.png')
now when i create new comment again it still shows, comment author name which is disabled in setting & 'preview' button which is also disabled.(see '5 new comment.png').

& if i refresh the page it works well, but then all this cycle repeat again

so what is the problem??
please help me...

Comments

imDhaval’s picture

anyone???

cuteapoot’s picture

I had a similar problem on my site where I could post once using AJAX and then it would throw an error every time. I found this bit in modules/nodeformsettings/commentformsettings/commentformsettings.module:

// on comment_form there's no $form['#node'] so we can't load the $node->type
		// we just take the argument
		// since we don't have node/nid when creating a comment on a separate form
		// we have to filter the two cases to check what argument to take and load
		// the node
		// TODO: find a better way to do this

So I figured that AJAX comments seem to handle this function just fine. I looked in ajax_settings.module and found some code that seemed to do the same thing in a better way. So I ended up switching this code (commentformsettings.module starting at line 103):

 if(arg(0) == 'node' && is_numeric(arg(1))) {
			$node = node_load(arg(1));
		}
		if(arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
			$node = node_load(arg(2));
		}
		if(arg(0) == 'comment' && arg(1) == 'edit' && is_numeric(arg(2))) {
			$node = node_load(arg(2));
		} 

With this code from ajax_settings.module (starting at line 113):

	if ($form['nid']['#value']) {
	    $node = node_load($form['nid']['#value']);
	  }
	  else {
	    $node = menu_get_object();
	    if ((!isset($node) || !$node->nid) && arg(0) == 'ajax_comments') {
	      $node = node_load(arg(2));
	    }
	  } 

It seemed to fix everything, and I was still able to add comments without AJAX Comments without breaking Comment Form Settings at all.

I would make a patch, but I'm pretty much a novice when it comes to Drupal. However, I think this code might be helpful for future versions of the module itself. Of course, the ajax code in there would have to be conditional or something, but it seems pretty close to what you would need.

lelizondo’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

I never used ajax comments before, but I'll give it a try to your method.

lelizondo’s picture

Assigned: Unassigned » lelizondo
Category: support » bug
Priority: Major » Normal