• Resolved SVTX

    (@12ax7)


    Hello folks,

    I googled this already but I can’t seem to find anything that even remotely addresses this. I have an issue where comment reply notifications go to a user’s old email address because upon change, this user’s comments are not being updated with his new email address. Is there a way to do this? Maybe a function that will run upon saving the new address?

    I’m using Theme My Login (front end login profile editing)
    and this plugin: Comment Email Reply

    I don’t understand why wordpress doesn’t automatically update the user meta in the comments as it seems to be such a basic thing?

Viewing 5 replies - 1 through 5 (of 5 total)
  • 1) After change user email not change on comments email address. so after change on your comment’s old email so this issue generate.

    now comment auto reply plugin take parent comment email for reply so u can change just go first comments setting, find user parent comment and quick edit and change old email to new one. now

    UPDATE wp_comments SET comment_author_email = REPLACE( comment_author_email, '[email protected]', '[email protected]' )

    second thing modify plugin file line no 31.
    get $comment_parent to user id and get user id to user email.

    or profile update hook on apply wp_comments folder user email id change based on id.

    Thread Starter SVTX

    (@12ax7)

    Interesting, thank you for taking time to look into this so closely. I will try this first thing when I’m back home. Thanks Ravi Patel!

    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);
    Thread Starter SVTX

    (@12ax7)

    WOW! You’re a STAR! That second code works beautifully! Thank you! ??

    Thread Starter SVTX

    (@12ax7)

    I’ve forwarded this to the plugin dev and told them to give you the appripriate credit for your work. Thanks again, I couldn’t be happier!

    See thread: Here

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Update old comments with new registered user email address?’ is closed to new replies.