This was definitely one of the most annoying things about my new Drupal installation. In addition to having user signatures added to every post once it's been submit, it has also added a signature to a reply box BEFORE submitting, basically resulting in a double signature.

You can imagine how annoying this may be when people post a reply and every time they see a signature added to a FIRST line of their new post. To begin writing they have to either delete that pre-added signature or move cursor to the beginning of the line. It's a serious usability issue if you ask me.

So I asked a few times in IRC, searched the forums like crazy, but I found no solution except for a signature.module for 4.6. I am using 4.7 though.

So then I went to comment.module, searched for "signature" in a comment.module file and got only two occurences. The second one is the culprit. It is the 1324:

 $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE);
  $form['comment_filter']['format'] = filter_form($edit['format']);

What I did to simply get rid of the added signature in a text area is delete this part of that line: ? $edit['comment'] : $user->signature

And it was gone. I tested to see if replying after this change works and it does so everything seems fine.

It is probably best to have the removed part only commented out as a slight reminder of where you made the edit. The final line should then look like this:

$form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment']/* ? $edit['comment'] : $user->signature*/, '#required' => TRUE);

The part between /* and */ is not parsed.

This is indeed a very simple and minor looking fix, but you might have desperately trying to get rid of this annoyance and couldn't find a fix, like me, so this could maybe prove useful.

I welcome expert opinions on if this could have any negative repercursions on the whole comments system since I'm not a php coder (just learning as I need it) and may not therefore be aware if there may be any consequences of removing that part of this line.

Thank you
Daniel

Comments

Libervisco’s picture

In above post I accidentally posted a wrong part. Instead of line 1324 I posted its end and line 1325.

The line 1324 is this

$form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE);

Just a minor fix to above post. :) All else is fine.

Cheers
Daniel

Southpaw’s picture

Thanks!! I found this little bug most annoying! (As did the rest of my users)

mjohnq3’s picture

I'm sorry but this seems like an unnecessary module hack for a solution in search of a problem. The whole idea of providing a user signature is so the user doesn't need to type it in each time he/she posts a comment. The post will show Submitted by UserID, but the signature doesn't have to be the user's ID at all. User tomsmith could use as his signature: Big Time Spender, or anything else he wants. As far as moving the cursor goes, the Home key will do that for you. Signatures are completely optional; if you don’t want one, don’t provide one for your account on your My Account page. I believe the default is no signature.

Just my two cents.

Southpaw’s picture

This hack removes the problem where the signature shows up in the comment box. If you don't remove that, you'll end up with 2 signatures after you submit it.

mjohnq3’s picture

Never seen two signatures in the comment. How many others have? Should this problem be posted as an issue?

Libervisco’s picture

Well considering that this thread got replies afterall it seems I'm not the only one that had this problem. It appeared even after I upgraded to 4.7.1 until I applied the fix above..

It would be nice if anyone else who had this problem replies here as well, just so we can see how many of us had it.

Thanks

Southpaw’s picture

I just installed 4.7.2 and the issue is still there. Had to remove it again.

Boinng’s picture

Yep, this is happening on my site - it may not be a bug as such, but it's certainly a usability issue that needs addressing, and I'm happy to have found a fix..

ryivhnn’s picture

The pre-fill is how drupal stuffs a signature in. What most people want is a nice clean box to write their comment in and for the signature to be appended, not for the signature to be there already.

Donno about everyone else but it's somewhere between annoying and terrifying for my users (annoying for the tech savvy ones and terrifying for the ones that just want to use the board), and I think it's ugly, so quite happy to axe it.

signature.module and flatforums automatically append the signature hence the double signature problem (I think, running on the assumption the autofill problem is happening everywhere coz I can't really tell from the posts I've been reading). So if you prefer the autofill thing then comment or delete the $sig or $signature lines in flatforum's forum-node.tpl.php.

works at bekandloz | plays at technonaturalist

sjfarrar’s picture

It might be worth trying out the signature module: http://drupal.org/node/64670

Hopefully that will do what you're trying to do without needing to hack around and stuff :)

sepeck’s picture

and I say if. Then please file an issue with the steps needed to replicate it against the Drupal project. It seems that some people do not have this issue and others do so it would be best if the issue were propoerly tracked and tested. Certainly drupal.org does not have this issue as far as I can tell nor can I replicate it on my test site with the information so provided.

Posting this in the forums does not file a bug report that can be tracked.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

sjfarrar’s picture

I have replicated this problem successfully after mucking around with signatures all day getting them to do one thing or another.

The following image shows the double signature behaviour: http://sjfworld.orcon.net.nz/forum2sig.jpg I am using drupal 4.7.0 and have the signature module installed and enabled. The top signature is the one generated by the signature module, and the bottom apparently something leftover from the comment module that the signature module isn't replacing correctly.

I haven't tried the code to fix this as suggested in the original post, but that seems to be how it comes about.

If I disable the signature module, as you would expect I get only the 'bottom' signature that seems to come from the comment module.

sjfarrar’s picture

Ok so I found that with the signature.module enabled, I was getting duplicate signatures (as you can see from the image above).

With my playing I found that I could do either of the following:
a) disable the signature module, somehow the signatures remain dynamic, but they show up in the comment box when you're editing a reply (just like they do here on the drupal site - horrible imo), or,
b) enable the signature module, signatures are dynamic, don't show up in the comment box, but they become duplicated.

I also noticed that the signature generated by the signature.module was not wrapped in a div class= tag, and yet the one generated (presumably by the comment module) was.

So I came up (with the help of a code monkey friend of mine) with this little piece of code to fix the problem.

/*fix duplicate signature problem*/
div.author-signature {
  display: none;
}

simply add that into the style.css file for your current theme and the second signature (the one presumably generated by the comment module) will no longer be shown. You could also wrap your signature as created by the signature module in div tags, so you can still apply special styling to the user's signature :)

Hope this helps some people

ultraBoy’s picture

It's quite a dirty fix, works for now, but doesn't explain the problem.

ragsman’s picture

I have this problem as well, but only in the forum. I have flatforum module installed, and from the pic sjfarrar posted, it appears that he does as well. I wonder if this problem is related to the flatforum module and not drupal itself?

ryivhnn’s picture

flatforum will automatically append signatures (it's part of its code to do so).

Problem is drupal appears to still be prefilling the comment box with signatures, thus you get double signature posting. I haven't tried the new signature.module yet but imagine you would get the same problem.

works at bekandloz | plays at technonaturalist

mohamedn’s picture

One of my users at http://www.qatarliving.com complained about this. I had never actually used a signature before so turned it on and I got a double post too. If I edit my comment and delete the signature from the text field then I get one signature out.

I'm also using the flatforum module...
-
Qatar - A Community Site

freeman-1’s picture

I faced the same problem of duplicate signatures too.

Instead of modifying any of the modules, I edited(commented out) the part that auto-appends the signature in the template file that comes with the Flatforum module (which you put at /themes/.../node-forum.tpl.php).

   <div class="comment-right">
   ...
        <?php // print check_markup($sig); ?>
   ...
   </div>

The catch is that the first topic node post will not have a signature. But I can live with that for now.

Mantichora’s picture

I also have this problem (while using flatforum).

I used the first fix as proposed by Libervisco, it just seemed to be the best one for me.

catch’s picture

I've started this issue to move signature handling from comment.module to profile.module - so it's included dynamically in the display rather than inserted in the comment form.

There's also a patch file in there which removes signatures from comment module - but it's not well tested yet.

Dabitch’s picture

Thanks to the original poster for this hack, it was very useful to me. Also thanks to you for moving the signature to be handled by display, much better.

catch’s picture

This was fixed (not by me) for Drupal 6.

fabrizioprocopio’s picture

I'm in the need to remove signature from user profile pages. It's an e-commerce website, so signatures is not necessary.
Can this tips solve my problem? Can I use it?
I use Drupal 5 and ubercart module

fab

ryivhnn’s picture

To my knowledge the sigs won't show unless you have code that shows them, so it wouldn't matter if users filled them in if you don't provide code that will display it. D6 lets you disable signatures in the user management thingo, though that would require an upgrade :) If the sig box really others you you could use css to hide the comment settings fieldset in the user profiles so they can't see a sigbox to set a signature in?

I'm guessing you need the comments to be on, otherwise that would probably be the quickest way to get rid of the signature box.

works at bekandloz | plays at technonaturalist