Make WordPress Core

Opened 15 years ago

Last modified 4 years ago

#10653 reviewing enhancement

Update comment_author when display_name changes

Reported by: mptre's profile mptre Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version: 5.1
Component: Comments Keywords: has-patch dev-feedback needs-refresh
Focuses: Cc:

Description

One thing that has bothered me recently is the fact that your previous comments doesn't get updated when your display_name is being updated. Which could cause some confusion. I wrote a function (see attached file for further reference) that takes care of this but I would love to see a similiar feature in the WordPress core.

Attachments (5)

update-comment-author.php (904 bytes) - added by mptre 15 years ago.
comment-template.patch (773 bytes) - added by prettyboymp 15 years ago.
get_comment_author.patch (1.0 KB) - added by apljdi 15 years ago.
garyc40-10653.patch (1.5 KB) - added by garyc40 14 years ago.
refreshed and "rephrased" apljdi's patch
10653.diff (4.4 KB) - added by matjack1 7 years ago.
Added unit tests and fixed different behaviour from current one

Download all attachments as: .zip

Change History (28)

#1 @scribu
15 years ago

  • Keywords has-patch added; comments author removed
  • Milestone changed from Unassigned to 2.9
  • Summary changed from Update comment_author when display_name changes. to Update comment_author when display_name changes

+ 1 on this.

#2 @prettyboymp
15 years ago

  • Cc mpretty@… added

Instead of updating all the comments on comment update, the get_comment_author function should be using the user's display name if available instead of using automatically using what is in the comments table as the name. see attachment:ticket:10653:comment-template.patch

#3 @ryan
15 years ago

  • Milestone changed from 2.9 to 3.0

#4 @apljdi
15 years ago

I like the idea of having the user's display_name reflected in the user's comments, and I like mpretty's suggestion that this is done dynamically. My only concern is that this could lead to confusion in the comments threads if some kind of tracking isn't implemented. If I change my nickname, set that as a display_name, comment a dozen time, then change my nickname again all of those comments would flip to a new 'user'. It seems to me like the comment_author should be written into the DB as the display_name on the first posting of the comment. After that, should the display_name change, the comment author ought to read something like "CurrentName (originally posted under OldName)".

#5 follow-up: @Denis-de-Bernardy
15 years ago

  • Component changed from General to Comments

http://core.trac.wordpress.org/ticket/5787#comment:3

potential problems:

  • Previously approved comments are changed without admin notification/approval.
  • Discussions on a post are often are in the context of "@display_name"
  • An upset or spammy person could abuse it.

Isn't compatible with WP Mu.

#7 @scribu
15 years ago

  • Keywords close added

Denis, very good points.

Proposing this be closed as wontfix and be left to a plugin.

#8 @Denis-de-Bernardy
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

#9 in reply to: ↑ 5 ; follow-ups: @apljdi
15 years ago

Replying to Denis-de-Bernardy:

These objections seem mostly inapplicable here.

http://core.trac.wordpress.org/ticket/5787#comment:3

potential problems:

  • Previously approved comments are changed without admin notification/approval.

In what way? mpretty's patch doesn't update anything it checks for an existing user and uses the display_name if a user is found. Nothing is changed.

  • Discussions on a post are often are in the context of "@display_name"

This was my concern but it is not an issue if changes are flagged as I suggested.

  • An upset or spammy person could abuse it.

This is also not an issue if changes are flagged as I suggested.

Actually, the current setup is prone to spammy abuse. I can comment under one name. Change my display_name and comment again. Because of the 'nickname' field I can do this as many times as I like. This wouldn't be addressed by anything suggested on this thread but it does make the 'spammy abuse' objection ring a little hollow.

Part of the issue here an underlying problem with the display_name feature-- it is inconsistently applied. Leaving things alone perpetuates that inconsistency. That is a mistake.

Isn't compatible with WP Mu.

Valid point. I don't WPMU enough to know what it would take to make it compatible.

Suggesting this be re-opened and solved, possibly (preferably) rolling that solution into a general solution, or set of solutions, to the display_name inconsistency problem.

#10 in reply to: ↑ 9 @apljdi
15 years ago

Actually, the current setup is prone to spammy abuse. I can comment under one name. Change my display_name and comment again. Because of the 'nickname' field I can do this as many times as I like. This wouldn't be addressed by anything suggested on this thread but it does make the 'spammy abuse' objection ring a little hollow.

Not sure what I was thinking here, because using display_name with an "Originally posted as..." flag would partially solve the display_name inconsistency and actually reduce the possibility of 'spammy abuse' already built into the system. It wouldn't be an adequate solution because usernames could 'chain' and it would still be confusing, but even with that effect connecting all the user aliases would still be possible

#11 in reply to: ↑ 9 ; follow-up: @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; has-patch close removed
  • Milestone set to 3.0
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Replying to apljdi:

I had only scanned this ticket, having stayed on the discussions on #5787

  • Previously approved comments are changed without admin notification/approval.

In what way? mpretty's patch doesn't update anything it checks for an existing user and uses the display_name if a user is found. Nothing is changed.

Picture the commenter's name gets changed to... mmm (checking my spam), SEO services, Viagra, Pharmacy pills, Yoga tips, whatever...

Isn't compatible with WP Mu.

Valid point. I don't WPMU enough to know what it would take to make it compatible.

Basically, you've as many wpmu comments tables as you've blogs.

The patch in this ticket is better than the ones from other tickets, in that -- contrary to the other ones -- it's dynamic. And your idea of "initially posted by..." makes sense to work around two of lloydbudd's above-mentioned points.

I think it also works around the WPMU issue. Re-opening. Needs a new patch and core dev feedback, though.

#12 in reply to: ↑ 11 @apljdi
15 years ago

Replying to Denis-de-Bernardy:

Picture the commenter's name gets changed to... mmm (checking my spam), SEO services, Viagra, Pharmacy pills, Yoga tips, whatever...

OK. I see what you mean. Its a problem, but it is only a problem with registered users as unregistered commenters can't change anything at all. That mitigates the issue a little, I think, since registered users have to get in with valid email addresses in the first place, which would make the spamming process considerably more time intensive, and registered users can be re-edited by admins. Still a problem though. display_names could be checked against Akismet's database or against the "Comment Blacklist" list in Settings->Discussion (odd to me that WP doesn't include any default values, actually). Also, this scenario is possible as things are right now with some, but not all, Settings->Discussion settings.

I think it also works around the WPMU issue. Re-opening. Needs a new patch and core dev feedback, though.

The patch should be fairly simple. I ought to be able to get to it in the next couple of days.

#13 @apljdi
15 years ago

  • Keywords has-patch added; needs-patch removed

#14 @nacin
15 years ago

Those strings in the default arguments need to be translatable.

#15 @nacin
15 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.0 to Future Release

@garyc40
14 years ago

refreshed and "rephrased" apljdi's patch

#16 @garyc40
14 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#17 @SergeyBiryukov
11 years ago

#25198 was marked as a duplicate.

#18 @chriscct7
9 years ago

  • Keywords needs-refresh added

@matjack1
7 years ago

Added unit tests and fixed different behaviour from current one

#19 @matjack1
7 years ago

  • Keywords needs-testing needs-refresh removed
  • Version set to trunk

I've just added a patch working on WP 5.0.0 with the missing tests.

I've written the tests first on the current function and then updated with the one in the patch. This showed a different behaviour that I've now fixed, but please let me know if you agree with my refactoring.

Plus I was wondering if we should pass the $before_alias and $after_alias also in the comment_author function.

#20 @matjack1
7 years ago

  • Keywords dev-feedback added

#21 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Status changed from reopened to reviewing

#22 @davidbaumwald
5 years ago

  • Keywords needs-refresh added

Latest patch fails against trunk so this needs a refresh.

#23 @ricjcs
4 years ago

I was going to report this but I noticed that it has been reported for over 12 years.

It would be very useful if it could be solved. I have a website where my profile has more than 40 comments, I wanted to change the display name, so that it is also changed in the comments I have to change one by one or resort to some trick.

Note: See TracTickets for help on using tickets.