Make WordPress Core

Opened 9 years ago

Last modified 3 years ago

#32851 new defect (bug)

Comment e-mail address of registered user not updated when user's e-mail address is changed

Reported by: ravipatel's profile ravipatel Owned by:
Milestone: Future Release Priority: normal
Severity: major Version:
Component: Comments Keywords: has-patch 2nd-opinion
Focuses: administration Cc:

Description

when i have register on blog and i have add 4 comment on different post.
Now 2'nd day i have change my email address on my profile.

now any one comment's reply is email gone my old email address which is not change after profile update on comments.

i have fix this issue on one member please review it 2 link for more info.

i hope u will understand me.

https://wordpress.org/support/topic/update-old-comments-with-new-registered-user-email-address?replies=6

https://wordpress.org/support/topic/development-bump

now i have fix this bug using this one code

function user_profile_update($user_id) {
     $commentarr = array();
     global $wpdb;

     if( !current_user_can( 'edit_user', $user_id ) ){
        return false;
     }

     if(isset($_POST['email'])):
            echo $email = esc_attr($_POST['email']);
            $wpdb->query("UPDATE $wpdb->comments SET comment_author_email='$email' WHERE user_id=$user_id");
     endif;
}
add_action('personal_options_update','my_profile_update', 10,2);
add_action('profile_update', 'user_profile_update', 10,2);

Attachments (1)

32851.patch (556 bytes) - added by egill 9 years ago.
32851.patch

Download all attachments as: .zip

Change History (12)

#1 @ravipatel
9 years ago

  • Keywords dev-feedback needs-patch added

This ticket was mentioned in Slack in #core by ravi. View the logs.


9 years ago

#3 @kraftbj
9 years ago

  • Focuses performance removed
  • Summary changed from Update old comments with registered user email address change issue. to Comment e-mail address of registered user not updated when user's e-mail address is changed
  • Version 4.2.2 deleted

Unsetting the version number, this field is to indicate the first version that displayed the issue.

One issue resolving this would fix is registered users who commented with a now-defunct e-mail address would, IIRC, still have their Gravatar pulled from the old e-mail address, which may be now disassociated with Gravatar.

#4 @ravipatel
9 years ago

  • Severity changed from normal to major

#5 @12AX7
9 years ago

Also, the user URL should be updated in the same way.

@egill
9 years ago

32851.patch

#6 @egill
9 years ago

Taking a stab at this one (2nd attempt submitting a patch, be gentle - or brutal, not sure which would be better).

Not sure if placing the update part in wp_insert_user() is acceptable, but that's what I went for in 32851.patch

Updating both comment_author_email and comment_author_url.

Last edited 9 years ago by egill (previous) (diff)

#7 @egill
9 years ago

  • Keywords has-patch added; needs-patch removed

This ticket was mentioned in Slack in #core-comments by rachelbaker. View the logs.


8 years ago

#9 @ravipatel
6 years ago

Any update regarding props (badge).

#10 @andraganescu
4 years ago

  • Keywords 2nd-opinion added; dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release

I have checked and this patch still applies cleanly and indeed it fixes the problem.

This particular problem though is not visible in any core feature. The fix can be handled by any plugin using the profile_update action, for example.

The patch should only do the update if the email is different and perhaps it could add a filter to make this behaviour customisable.

It does seem like a bug to leave old comments assigned to an user but to not update the user's email according to the data in the user's profile. So, while this is a valid ticket the patch needs a bit of more work.

@egill do you think you could refresh it a bit with the above additions?

#11 @ravipatel
3 years ago

@andraganescu @egill

Any plan for cover in 5.6 release?

Note: See TracTickets for help on using tickets.