[Resolved] Woo product reviews disclose customer's full name

Home Forums Support [Resolved] Woo product reviews disclose customer's full name

Home Forums Support Woo product reviews disclose customer's full name

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #327977
    Sven

    Hi there,

    I may have found a potential privacy issue with the theme being the product reviews show the customer’s full name. I suggest to only display the first name as that should suffice for a public review? I’m using the Statement child theme.

    Best regards

    #328101
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    That should be handled by WooCommerce, not the theme. If there’s no option in the WooCommerce settings for that, it might be worth asking their support if they have a solution.

    #328114
    Sven

    Ah, I see! Sorry for the hickup then.

    #328124
    Sven

    If anyone else is stumbling upon this, here’s the code to fix it:

    add_filter('get_comment_author', 'my_comment_author', 10, 1);
    
    function my_comment_author( $author = '' ) {
    // Get the comment ID from WP_Query
    $comment = get_comment( $comment_ID );
    if (!empty($comment->comment_author) ) {
    if($comment->user_id > 0){
    $user=get_userdata($comment->user_id);
    $author=$user->first_name.' '.substr($user->last_name,0,1).'.'; // this is the actual line you want to change
    } else {
    $author = __('Anonymous');
    }
    } else {
    $author = $comment->comment_author;
    }
    
    return $author;
    }

    Credit:
    https://silicondales.com/tutorials/woocommerce-tutorials/woocommerce-change-review-author-display-name-username/

    #328262
    Tom
    Lead Developer
    Lead Developer

    Thanks for posting the solution! 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.