In the Drupal comments/ signature system, there is a usability problem with the signature.

The main problem is that, when adding a comment, the signature appears in the same line as the textarea that you are writing the content of your post. When you begin typing, your new text actually appears AFTER the signature (at least in Konqueror 3.2).

This makes it incredibly annoying for users because you have to go to the beginning of the textarea before you can type your data.

A corrolary to this problem is that, when quoting (using the quote module), the signature is included by default in the quote, which should not be the default behaviour.

It appears that the signature is being added to the actual body text of the comment, as opposed to being retrieved from the user's profile when the page is rendered.

--

From an engineering/design perspective, one possible way to fix this is instead of adding the signature text to the comment, instead retrieve the signature dynamically from the user's profile when the page is rendered. If you do this, not only do you avoid the above problems, but you also improve the flexibility of signatures (for example, changing it once will cause the signature to change in every comment you make). You can also use this design change to give the users a choice of when to display their signature (for example, by using a checkbox on the node that says, "Display your signature with this post").

--

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

irwin’s picture

Included: patch.

Changes explanation:

"theme_comment_form": the code to autoinsert the signature into the textarea is removed.

"theme_comment_view": code added to insert signature at the end of the $comment->comment data structure. I encase the comment in [p class="signature"] [/p] (with the correct brackets of course) so that a CSS theme can change the appearance of signatures.

Caveat: the sig still appears in the [div class="body"] of the comment theme.

Added function _comment_get_signature($uid), which gets a signature, given a user ID.

Caveat: this requires an additional query to the "users" table with every user comment.

Tested with:
- User without signature
- User with signature
- Anonymous poster

- Previewing
- Positng

- Editing a signature: expected result is that all signatures are changed to reflect the new signature.

Please let me know of any problems.

irwin’s picture

Priority: Normal » Minor

Reducing severity to "minor" because that's what it is.

Bart Jansens’s picture

The extra queries aren't necessary, the queries that are used to retrieve the comments already join the users table, just add u.signature to the select clause there.

I'm not sure if adding the signature to the comment body is the best approach, if you just keep it in a different field, themes can decide where to place it.
Note that usually admins will want to be able to use a different filter for signatures. Eg, allow bbcode in the comment body, but not in the signature.

I am using a similar patch on my own site (although it really needs to be updated), it never made it into core because it is difficult or almost impossible to create an upgrade path. I hope this can be discussed again, or at least made into an option for new sites, i'm surprised there haven't been more complaints about this ;)

irwin’s picture

I realised as I was going to bed last night that the extra query was extraneous. :)

As for adding the comment to the comment body, the reason I would want to do that is for the signature to "appear" to be a part of the... well, comment body. That will avoid potential issues with some themes that aren't designed to handle signatures at all - for instance, a theme might put a border around the "body" part of the signature, and if it doesn't explicitly handle the signature, things can look very ugly and strange.

But I can see what you mean about Input Filtering. Do you have suggestions on how to improve that? I had one idea, and that was to add the signature as an argument to the theme, but that would require theme modifications fir signatures to be displayed.

If this patch is of interest I'll keep working on it and posting updates.

Steven’s picture

Have you considered that not everyone might want retroactive signatures? It depends on the preference of the site owner I guess.

Steven’s picture

By the way, the comments are currently fetched with a single query. You could easily extend it to get the signature with a JOIN instead of doing a query per comment.

Bèr Kessels’s picture

It depends on the preference of the site owner I guess.

Please, no. Not a config optin for this. Choose the best default and optimise that. We must get /less/ options instead of more.

Another option (hehe) would be to make two tiny modules with signature-code in them, and remove all the signature code from user and comment.module.
one module would be: signature_static.module. That one would add signatures to nodes and comments like we do it now: concanate it to the $node->body on insert in the DB.
signature_dynamic.module would concenate on output, and not store the data in the DB with every comment and node.

Bèr

andremolnar’s picture

Another option (hehe) would be to make two tiny modules with signature-code in them, and remove all the signature code from user and comment.module.

+1 to any approach that removes code from user.module. I've realized lately that user.module does too many things that might be better done as seperate modules that extend the core user module. In other words anything that makes user.module more modular is a great idea!

andre

killes@www.drop.org’s picture

Component: comment.module » user system

Refactoring to pull the signature functio out if comment module (or make the standard overridable) is probably the way to go.

jakeg’s picture

Component: user system » comment.module

What's the status of this?

My users badly want signatures to work so that when they chanage their signature it changes it on every one of there posts, such as in existing forum software.

Also, it means they don't have the comments box prefilled with their signature every time the post a comment, which is extremely annoying, especially when also using quote.module.

ultraBoy’s picture

Component: comment.module » module system
Assigned: Unassigned » ultraBoy
Category: bug » task

I'm going to write a 'signature' module, to pull out signature functions from comments module. Now it's really annoying and not usable at all!

beginner’s picture

Also, any way to add some extra html, like

<span class="signature">actual sig here</span>

so that it can be styled differently from the post.

and what about attaching the signature in a new thread?

(by the way, I tried to preview this post, but when I click the button 'preview', the page reloads, but there is no preview at the top nor at the bottom of the post. My only option is to post without previewing)

B.

Marandb’s picture

I am also wondering if there is any update here.

I have been unable to locate a "Signature" module. Is there one in the works? Anything I can do to help out. (other than coding ;) )

This feature will be huge in making my site alot more user friendly.

Thanks,
-- Marand

Hosting Geek’s picture

Yea alot of people are going to be wondering as you have been PlanetSoCed: http://www.planetsoc.com/node/171

ultraBoy’s picture

Status: Active » Fixed
FileSize
28.01 KB
Anonymous’s picture

Status: Fixed » Closed (fixed)
neablo’s picture

Version: » 4.6.5
Component: module system » other
Assigned: ultraBoy » neablo
Status: Closed (fixed) » Active

How can I make this module function with phptemplate??

Julien PHAM’s picture

I should add too... will you create a cvs version of signature too?

ultraBoy’s picture

Assigned: neablo » ultraBoy
Priority: Minor » Normal
ultraBoy’s picture

Version: 4.6.5 » x.y.z
ultraBoy’s picture

Status: Active » Closed (duplicate)
apaderno’s picture

Version: 10.0.x-dev » 4.6.x-dev
Assigned: ultraBoy » Unassigned