admin管理员组文章数量:1335171
How to display list of replies to his comments in user profile of current user. my website can send notification that example: "someone replied to your comment" and when i click the link that was sent by notification email it forward me to comment page. i also want to list these replies in user profile. thanks for attention
How to display list of replies to his comments in user profile of current user. my website can send notification that example: "someone replied to your comment" and when i click the link that was sent by notification email it forward me to comment page. i also want to list these replies in user profile. thanks for attention
Share Improve this question edited Jul 14, 2020 at 9:37 Gidromasservis QSC asked Jul 14, 2020 at 4:07 Gidromasservis QSCGidromasservis QSC 331 silver badge10 bronze badges1 Answer
Reset to default 0I also have a page where I list comments and replies to the current user comments.
I might not be able to explain the answer very well, but this is what I did. I listed all the comments of the current user and listed again the comments with the parent_id of the current user's comments.
$comments = get_comments( array(
'user_id' => (get_current_user_id()),
'status' => array( 'approve', 'hold' ),
'type' => 'comment'
)
);
foreach ( $comments as $comment ) {
echo $comment->comment_content;
$parent_id = $comment->comment_ID;
$replies = get_comments( array(
'status' => array( 'approve', 'hold' ),
'type' => 'comment',
'parent' => $parent_id
)
);
foreach ( $replies as $reply ) {
echo $reply->comment_author;
echo $reply->comment_content;
}
}
In a WordPress environment this is the best way I have come up with.
本文标签: How to display replies to his comments in user profile of current user
版权声明:本文标题:How to display replies to his comments in user profile of current user 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742263559a2442964.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论