• Hello and thank you for the wonderful plugin!

    I am using the ‘hidden’ option for restricting a post. In the docs it reads that the post is ‘hidden’ unless the user is logged in. However, ever after login the post is still hidden from the index. Is the index considered and ‘archive template’?

    The expected (and wanted!:) behavior would be that the post should not be visible/accessible by any non-logged in users, but visible/accessible depending on the membership product.

    Is this a bug, or didn’t I get something right?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    The hidden post feature requires a larger than normal query for post IDs, so rather than put that into every page load, the result is stored in a transient that expires and is refreshed periodically.

    Normally, that would be updated anytime a post has a hidden status change (either “set to” or “removed from”). But, it’s possible that the transient wasn’t refreshed right away when you were looking at it.

    The setting expires every 5 minutes so the first thing I would do is resave your post, give it some time, and then recheck.

    Thread Starter scooterlord

    (@scooterlord)

    Thank you Chad for your swift reply. I have the files locally at the office but will check tomorrow morning and revert in case this ‘issue’ troubles others as well.

    Thread Starter scooterlord

    (@scooterlord)

    Hello again Chad,

    unfortunately it is still not working. I cleared the cache, switched browsers, but nothing, hidden posts can be accessed, but are not available in the index.

    – I am using worpdress admin user.
    – Have enabled creation of different memebership products
    – Added a product without a role restriction/expiration
    – Entered the post, set status to hidden, limited access to the product (I also tried without it)
    – logged in, post accessible if I use slug directly, not available at index.

    Any other ideas? Thank you again for your time and effort.

    Plugin Author Chad Butler

    (@cbutlerjr)

    – I am using worpdress admin user.

    Does the admin user you’re testing with have the product access you’re testing for? Check the profile of the user to make sure that particular product access is enabled. Admins do not (currently) have automatic access to restricted content.

    Thread Starter scooterlord

    (@scooterlord)

    Chad, hello again!

    Yes, the admin has product access enabled in the profile.

    Edit: I created a new user, attached membership products, created new post, changed limit access to both membership products, changed to hidden – same result.

    Just making sure – hidden posts are supposed to be hidden for index but NOT archive and search templates, unless a user with membership access logs in, right?

    • This reply was modified 6 years, 5 months ago by scooterlord.
    Thread Starter scooterlord

    (@scooterlord)

    Chad hello,

    did you have any time to investigate the issue? Is there something I can do to help you out in pinpointing the issue?

    Edit: I managed to narrow down the problem. I made a new installation just to make sure I started from scratch.

    Hidden and blocked posts work as they should when no membership products are created.

    Then I tried this:

    – I enabled membership products and created two of them – prod1 and prod2.
    – I enabled each product separately on my user: a) only prod1, b) only prod2, c) both prod1 and prod2
    – In my post I tried all 3 cases: a) no restriction, b) limit access to prod1, c) limit access to prod2

    In my post if I set it to ‘Blocked’ – it works as expected for all cases above.

    If I set the post to ‘Hidden’, then the product is restricted normally as it should when navigating to the single url, but NOT displayed in the index, except if there is no ‘limit access’ option (or essentially set to ‘None’)

    So it must be a bug of the post not showing:
    – On index
    – When ‘Hidden’ is enabled for a post
    – When membership products are enabled and limited access is assigned.

    • This reply was modified 6 years, 5 months ago by scooterlord.
    Thread Starter scooterlord

    (@scooterlord)

    …if it helps, if I replace #942 in inc/class-wp-members.php from:

    if ( ! isset( $wpmem->user->access[ $key ] ) || ! $wpmem->user->is_current( $wpmem->user->access[ $key ] ) ) {

    to:
    if ( ! isset( $wpmem->user->access[ $key ] )) {

    …it seems to be working, but not in full. If there are multiple limit conditions for the post, and these multiple products are not applied on the user, then it still doesn’t work – so I guess this is what the removal of code breaks.

    • This reply was modified 6 years, 5 months ago by scooterlord.
    • This reply was modified 6 years, 5 months ago by scooterlord.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hidden post not shown when user is logged in’ is closed to new replies.