Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In theme_comment_view(), there's a check to see if a comment is new or not. If new, a "new" ID is output for the comment. If there are multiple new comments, they will get duplicate IDs, which is forbidden in (X)HTML. We should use classes instead of IDs so themes can style new comments. The first new comment should also have an ID. This would require theme changes, as well as comment.module changes.
Comment | File | Size | Author |
---|---|---|---|
#9 | comment_new_id.patch | 930 bytes | Zen |
#5 | comment_32.patch | 887 bytes | Zen |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedverified on drupal.org. we should not be doing this.
Comment #2
Junyor CreditAttribution: Junyor commentedI've been looking into this a bit today. The comment that should have the "new" ID is dependent on the order of the comment page. I think the first new message chronologically should have the "new" ID. We can do a check similar to the one in comment_render to see what order the page is in. If the page is reverse chronological, we'll have to use a counter to find the oldest new comment.
I'll give this some more thought and see if I can come up with a good solution.
Comment #3
Uwe Hermann CreditAttribution: Uwe Hermann commentedAny updates on this?
Comment #4
Junyor CreditAttribution: Junyor commentedI haven't come up with a better way of doing it, but it's still happening (AFAICT; I tested on drupal.org).
Comment #5
Zen CreditAttribution: Zen commentedI disagree. It should be the *first* new comment on a page. This way, I just have to keep scrolling down the page to read other new comments and avoid missing other new comments above my current page position.
Moreover, this keeps the patch simple. Please review =)
Thanks,
-K
Comment #6
Zen CreditAttribution: Zen commentedComment #7
Dries CreditAttribution: Dries commentedI support the last patch. However, maybe we should explore a different solution too; rather than generating a 'new' id, maybe we can just use the actual $comment->cid? Looks like that might be less code and slightly more elegant (we are already querying the number of new comments) ... Not sure it will work but maybe someone could explore that path?
Comment #8
drummLooks good and it is good to see someone working on the default implementation of themeable functions.
However, I think the wording could be a bit better. Maybe $new_id_used or $first_new (with TRUE/FALSE flipped).
Comment #9
Zen CreditAttribution: Zen commentedPatch updated as per Drumm's comments against 4-7-4.
-K
Comment #10
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedmoving
Comment #11
ChrisKennedy CreditAttribution: ChrisKennedy commented+1
It is terrible usability for the link to new comments to go to the last one. On drupal.org I constantly have to search backwards through pages to find the oldest unread comment. It is completely annoying.
Comment #12
drummCommitted to HEAD.
Comment #13
m3avrck CreditAttribution: m3avrck commentedComment #14
m3avrck CreditAttribution: m3avrck commentedShould be applied to 4.7 too. Should still apply to 4.7...
Comment #15
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied
Comment #16
(not verified) CreditAttribution: commented