[drupal-devel] [bug] Signature "interrupts" typing comments due to existence in text field

irwin drupal-devel at drupal.org
Fri Feb 4 15:40:42 UTC 2005


 Project:      Drupal
 Version:      cvs
 Component:    comment.module
 Category:     bug reports
 Priority:     minor
 Assigned to:  Anonymous
 Reported by:  irwin
 Updated by:   irwin
 Status:       patch

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.


irwin



Previous comments:
------------------------------------------------------------------------

February 3, 2005 - 23:47 : irwin

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.


------------------------------------------------------------------------

February 4, 2005 - 00:49 : irwin

Attachment: http://drupal.org/files/issues/signature_load_on_render-20050204.patch (1.62 KB)

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.


------------------------------------------------------------------------

February 4, 2005 - 00:50 : irwin

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


------------------------------------------------------------------------

February 4, 2005 - 04:15 : Bart Jansens

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 ;)


-- 
View: http://drupal.org/node/16726
Edit: http://drupal.org/project/comments/add/16726





More information about the drupal-devel mailing list