Check if user has comment on current post

Question

Hello I have multiauthor website and I need to create a condition to check if defined user ( no current user ) has comment on current post.
Here is my code but I can not complete this

$userid = "444"; //this is the user that I need to Check if has comments on current post

$commenters = array("444", "544", "245", "453", "773", "990"); //here I need to get array of users ids who have comment in current post and check if user with the id 444 exist in this array
if(in_array($userid, $commenters)){ 
    echo " user with the id 444 have comment in current article";
}
else {
    echo "user with the id 444 have no comment in current article";
}

my problem is that how can I get array of users ids who have comment in current post or do you have any better alternative to code. Thanks for your attention

0
Teymur Abbasov 3 weeks 2022-06-18T00:58:34-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse