问题描述
此代码(以下)检查对产品发表评论的客户的姓名和姓氏。仅显示姓名的第一个字母。几颗星出现在下面。例如,在产品页面的评论部分;如果一个叫Ayhan Can的人发表评论,其他顾客将看到这样的名字:A **** C ****但是,此代码在Store Page> Review中不起作用。因此,客户的姓名和姓氏将准确显示。我应该为Dokan商店页面添加什么内容?
还;
文件://wp-content/plugins/dokan-pro/modules/store-reviews/functions.PHP 函数dsr_save_store_review
[
我的代码是:
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 = mb_substr($user->first_name,1,'UTF-8').'***'.' '.mb_substr($user->last_name,'UTF-8').'***';
} else {
$author = mb_substr($user->first_name,'UTF-8').'***';
}
} else {
$author = $comment->comment_author;
}
return $author;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)