I totally understand what you’re saying and I believe I can work out the issues – but I’ll have to track down where that needs to work out, and it may require some additional changes.
The way I see it the comments on a blocked post should only be visible if the user is logged in and also has permission to read the post. If there is no user logged in OR the user doesn’t have permission then the $comments array should be nulled.
I think the confusion arises because line 861 is a double negative. Another way of doing it would be:
$comments = ( is_user_logged_in() && ! wpmem_is_blocked() ) ? $comments : array();
ie “If a user is logged in AND the post is NOT blocked THEN show the comments, otherwise hide them.”
Part of the problem with how you’re looking at it is that you’re looking at wpmem_is_blocked() as an access conditional (i.e. whether a user has access or not), but that’s not how that function works. If a post is blocked, it will return true always – it has nothing to do with the user.
We’re kind of in a transitional period in the plugin’s development – moving from a single membership to multiple. It’s also new to allow content to be “hidden”. Between those two newer features, there are situations where some previously unseen issues may come into play.
In terms of the comments with regards to hidden posts, those are currently determined in the main object class (what you’ve already been looking at), but there is an additional element in the Products class (that handles memberships) and the comments are filtered there based on user access.
I think all of that works fine for whether comments are displayed on the post or not. However, in situations like a “recent comments” widget that may not work out as intended/needed.
It may be that the comments array needs to be handled earlier than it currently is. It may need to be something that loads into the plugin’s main object right away – OR – alternatively, another approach may be that if the comments array is accessed and it contains comments from multiple posts (such as recent comments) that any that match inaccessible post IDs are dropped from the array.
I’m not sure what the ultimate solution will be – these are just general thoughts at present – but I will review it for improvement.
I have to say that other than this little issue and the other thread I’ve opened this has to be by a long way the best content restriction plug in in the WordPress directory. I’ve tested almost every free similar plugin over the last fortnight and none of the others are as intuitive to use or as complete.
Glad to hear that – I do try to make it as simple/intuitive as possible.