Ahh. For some reason, $showcomments isn’t being set to “Y” up above, it may not like the particular syntax. I also didn’t have you set it to “N” if the person can’t see the comments. Let’s start there and at least see if the error goes away.
Up where you set $showcomments to “Y”, make the code say this:
{exp:weblog:entries weblog="{my_weblog}" status="open|Private" orderby="date" sort="desc" limit="1"}
<?php
if (("{status}" == "private") && (("{member_group}" == "1") OR ("{member_group}" == "8"))){
$showcomments = "Y";
}
else{
$showcomments = "N";
}
?>
...(rest of entry display code here)
That should ad least make the variable have something in it when it gets checked later on. If the error goes away, and the comments are still visible to all, then it’s in the syntax of the if statement and we’ll go from there.
Also, are members of group 1 or 8 the only ones allowed to see comments of private posts? If so, the code doesn’t even need to check to see if the message is private when setting $showcomments to “Y”. It just needs to check for the member groups.
If that’s the case, then make it this:
{exp:weblog:entries weblog="{my_weblog}" status="open|Private" orderby="date" sort="desc" limit="1"}
<?php
if ("{member_group}" == "1" OR "{member_group}" == "8"){
$showcomments = "Y";
}
else{
$showcomments = "N";
}
?>
...(rest of entry display code here)
And glad to help 😊