I have a front end client portal I created when a user logs in they are redirected to a page called "Dashboard". The pages displays recent projects, invoices, and recent messages.
Recent messages displays comments of all comments posted by a current user. What I would like to do is also display comments when someone replies to the comment or post a comment in their assigned project.
Example
Designer A (user administrator) leaves a comment for Project 1 for Client 1.
When Client 1 signs into the portal he will see Designers A comment in the recent message field.
Once Client 1 leaves a comment they can see their comment in the recent message feed along side Designer A comment.
As of right now I am able to display all post based on the user who logs in thanks to this post https://stackoverflow.com/questions/11009734/how-to-display-loged-in-users-comments-only-on-wordpress.
Example
-Client logs in and will be able to see all their comments plus comments that are associated with them. (meaning when a designer leaves a comment on their post)
-Administrator can see all comments in their feed
<?php
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
$args = array(
'status' => 'approve',
'order' => 'DESC',
'user_id' => $user_id
);
$comments = get_comments($args);
foreach($comments as $comment) :
echo '<p>';
echo($comment->comment_author . '<br />' . $comment->comment_content);
echo '</p>';
endforeach;
}
?>