This is a great module. I have a problem with it on my node based user profile pages - which are presented in a panel.

On these pages there is a comment field acting as a guestbook. For some reason it is not picking up the node title - the comment subject appears pre-filled as just 'Re:' Submitted user profile comments all have the subject 'Re:' and the recent comments block looks pretty meaningless.

However, If I delete this 'Re:' in the subject line and add a comment and then submit it does then print Re: plus the correct node title along with the comment. So it seems it is almost working - but the initial presentation of the comment subject field is going wrong.

I've tried changing the module weight but this has no effect.

Any idea how to fix this?

Thanks for any info

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arhak’s picture

Status: Active » Needs review
FileSize
560 bytes

this is a quick shot in the dark
let me know the outcome

plan9’s picture

Hi

Thanks for the speedy patch! unfortunately It hasn't fixed the problem.

The comment form is inside a mini panel on a panels page. I don't know if this makes any difference?
Also: I am using Page Title with tokens to title profile pages with user names - but I did disable this and the comments subjects still behave as described.

Perhaps this should be in the panels queue?

Cheers

G

arhak’s picture

Status: Needs review » Active

Perhaps this should be in the panels queue?

I'm sure the problem is in this module
but I'm disinclined to set up a D5 with some 5.x modules

nevertheless, this problem might be present in 6.x version

how is the URL of those pages? (I mean without considering aliases, e.g. user/1/edit)
do you have Devel enabled? (having you to "Execute PHP" might help a lot, in a testing environment, of course)

plan9’s picture

The path to the page is user/%

I do have Devel on my development server - but only really know how to use it to clear caches.
I can do a minimal D5 install to test also.

Will report back.

G

arhak’s picture

what I would like you to do is to enable the "Execute PHP" block (comes with devel)
place it in a sidebar (or footer, whatever region you want)
so I can provide some snippets to figure where the problem might be

plan9’s picture

I've got the Devel block in the footer. If you go ahead and give me some snippets and instructions I will post the results.

Thanks.

arhak’s picture

Note that I haven't examined D5 for API change,
so we might jump into incompatibility errors while trying to test these snippets (D6)

first, check that a proper comment_form is built

  $comment['subject'] = 'test';
  $comment['comment'] = 'testing';
  $form_state = array();
  $form = drupal_retrieve_form('comment_form', $form_state, $comment);
  print_r($form['subject']);

then, look for an existing node id to test how the subject is built

  $nid = 11; // an existing node id (nid)
  $comment['nid'] = $nid;
  $comment['comment'] = 'testing';
  $form_id = 'comment_form';
  $form_state = array();
  $args = array($form_id, $comment);
  $form = drupal_rebuild_form($form_id, $form_state, $args);
  print_r($form['subject']);

and finally, look for an existing comment id to test how the subject is built when replying to another comment

  $cid = 30; // an existing comment id (cid)
  $comment['pid'] = $cid;
  $comment['comment'] = 'testing';
  $form_id = 'comment_form';
  $form_state = array();
  $args = array($form_id, $comment);
  $form = drupal_rebuild_form($form_id, $form_state, $args);
  print_r($form['subject']);

Note: for these test just pick up any $nid or $cid (of an existing node or comment respectively)
it doesn't matter if they're related, not even if comments are enabled
the form should be built on these arbitrary demands

plan9’s picture

Suddenly - on my dev server - it started working properly (with patch applied in #1).
I disabled and re-eneabled the modules on the live site and it now appears to be working fine there also.

I have no caching whatsoever on the dev server - and I don't normally have to disable / re-enable modules when applying patches - who knows....

Anyway - basically your patch has made it possible for comment subjects to function inside panels pages. Perhaps this is also relevant for 6.x?

Thanks very much for all your help with this.

arhak’s picture

Status: Active » Needs review

yes, it is relevant for 6.x as well (is the same approach there, no consideration for comments out of node/* & comment/* paths)

however, I ask you to brake it again (in your dev server) to confirm that it is working thanks to the proposed patch

when you find the time, unpatch it (and if needed clear cache, re-enable it or what so ever, which BTW doesn't makes sense unless having some enabled cache getting in the middle)
and please, report back your results to make it official

thanks for your feedback

plan9’s picture

Hi

I have tested the unpatched version of the module and the bug re-appeared. So it looks like the patch is needed for comments in panels.

Thanks for fixing this.

arhak’s picture

Status: Needs review » Reviewed & tested by the community

thanks

mitylite’s picture

Can somebody post the patched module for 6.2 dev? I'm not developer, I'm not able to apply patches...

arhak’s picture

for 6.2 dev?

the proposed fix would be applicable to 6.x-1.x, but not for 6.x-2.x

post the patched module

I don't think someone will post the whole module with a patch applied
if you're interested on making it work for 6.x-1.x you can copy the lines prefixed with a plus sign (see the patch) between lines 44 and 45 of the comment_subject.module file (version 6.x-1.x)
(or you may ask for a 6.x-1.x patch, but it seems that you won't know how to deal with it)

mitylite’s picture

Nevermind my earlier comment I've learned about patching. :p

arhak’s picture

@#14 then for 6.x-1.x here you are

mitylite’s picture

Thanks arhak. :p