Found a Verified, Reproducible bug in Protected Content

Bug Verified and Reproduced on WPMUDEV internal System.

Video of Issue:
https://www.dropbox.com/s/b1cmtpfsm04b18i/ForPatrick.mp4?dl=0
(just in case it doesn't attach)

Conclusion first, followed by the full thread:

Conclusion:

Patrickat 6:29 pm
Individual posts of a custom post-type can be accessed when granted in the membership, but the post-type archive page cannot. Include a link to your movie (with popcorn this time please)

RobertKwasnyat 6:31 pm
OK, thanks Patrick! I'm collecting up this thread and will clean it up for the Ticket... thanks for discovering the bug!

@RobertKwasny BTW, I just did a quick test on my site with our Events plugin and the bug is confirmed: no access to the CPT archive

Full Thread:
RobertKwasnyat 5:17 pm
@Patrick Having a hard time getting Events to show up -- getting it past Protected Content Plug In. I have the Categories protected, Menus protected and Protect Custom Post Types protected too... Protected as in able to only be seen by Members.

RobertKwasnyat 5:18 pm
@Patrick And I realize, it's not the topic of the hour but I'm REALLY stuck :wink:

Patrickat 5:23 pm
@RobertKwasny Are your events also included in the post-types you have protected?

RobertKwasnyat 5:24 pm
@Patrick I'll triple check

RobertKwasnyat 5:27 pm
@Patrick
Protect Categories:
Protect Categories:
Protected Categories:

Protect Custom Post Types: Event

Protected Custom Post Types: Event

Patrickat 5:28 pm
@RobertKwasny And are the events accessible on your membership(s)?

RobertKwasnyat 5:31 pm
@Patrick Grab your popcorn -- I made a movie: https://www.dropbox.com/s/b1cmtpfsm04b18i/ForPatrick.mp4?dl=0

Patrickat 5:35 pm
@RobertKwasny Oh, are you still logged-in as admin while viewing your site? That won't work at all. You need to view the site as a user on the membership you're testing against (use another browser for that, it's easier than logging out/in), or use the Test Memberships button in the toolbar at top-left of your site

@Patrick Nope, I have Firefox open as Admin, Chrome as Subscriber...

RobertKwasnyat 5:37 pm
@Patrick No Problem... that Velvet Blue is a life saver, how's the movie?

Patrickat 5:37 pm
@RobertKwasny Oh phooey, I thought I got smart for a second there :slight_frown:

Patrickat 5:38 pm
@RobertKwasny Is the membership activated, as well as content protection?

Kimat 5:38 pm
Don't forget about me over here. I'm falling asleep

RobertKwasnyat 5:39 pm
@Patrick Yep, added all 93 members... before I did that, the "other" protected content wasn't showing up... it does now, except for the Events

Patrickat 5:54 pm
@RobertKwasny Loved it, gonna be a sequel? lol Have you granted support access to your site yet?

RobertKwasnyat 5:57 pm
@Patrick Have you granted support access to your site yet? Never done that... how?

Patrickat 5:58 pm
https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

Patrickat 5:59 pm
@RobertKwasny Once enabled, I'll see a nice login button ext to the site you've enabled it on in your account here

RobertKwasnyat 6:00 pm
@Patrick Happy to share log in info... HOW COOL IS THAT? Support Staff Access

Support staff access successfully enabled!

Here you can grant WPMU DEV support staff temporary admin access to this site, review staff access history, and revoke access. This is completely secure, optional, and fully controlled by you. More info »
Support access is ACTIVE until January 10, 2015 11:00 pm

RobertKwasnyat 6:01 pm
@Patrick Had no idea that existed!

Patrickat 6:01 pm
@RobertKwasny Yup, I see it. Logging in now to see if I can help figure this out with ya :

RobertKwasnyat 6:01 pm
@Patrick Excellent!!

Patrickat 6:03 pm
@RobertKwasny Whoops, you have 2 possibly conflicting elements in there: Events and Event. Lemme dig in...

Patrickat 6:07 pm
@RobertKwasny You also have the Membership plugin active on that site. That will definitely conflict

Patrickat 6:07 pm
@RobertKwasny I just disabled Membership, testing now...

Patrickat 6:08 pm
@RobertKwasny That seems to have done it :slight_smile:

@RobertKwasny If you're gonna use Protected Content, please delete Membership (I just disabled it for now)

RobertKwasnyat 6:09 pm
@Patrick Awesome... let me spin it on Chrome, one sec

Patrickat 6:09 pm
@RobertKwasny While logged out in Chrome, all I see are Home
Contact Us
Account Login
On-Line Application

RobertKwasnyat 6:10 pm
@Patrick Correct, when logged in, I should see everything else...

Patrickat 6:10 pm
Yup :slight_smile:

RobertKwasnyat 6:10 pm
@Patrick Still not bringing it up

RobertKwasnyat 6:12 pm
@Patrick Login: hotdog password: patrick123

Patrickat 6:12 pm
@RobertKwasny Cool, lemme try that...

Patrickat 6:13 pm
@RobertKwasny Works for me. Cleared your cookies & cache in Chrome yet?

Patrickat 6:14 pm
I see the Upcoming Events menu and page. The page is blank tho

RobertKwasnyat 6:15 pm
Menu has been there all along, but the older Events and the 2 upcoming Events are not displaying... so odd!

RobertKwasnyat 6:16 pm
But the Cache Clear did make a difference, thanks!

RobertKwasnyat 6:17 pm
Have a bunch of Events before and after today: Title Event Categories Event Tags Image Start Date End Date Shortcode
Select All Title Event Categories Event Tags Image Start Date End Date Shortcode
Select Meeting 1/13/15
Meeting 1/13/15
Events —
0
No Featured Media 2015-01-13 @ 07:00 am 2015-01-13 @ 08:00 am [event id="2785"]
Select 1-6-15 Breakfast Meeting
1-6-15 Breakfast Meeting
Events —
0
No Featured Media 2015-01-06 @ 07:00 am 2015-01-06 @ 08:00 am [event id="2705"]
Select 10-21-2014 Breakfast Meeting
10-21-2014 Breakfast Meeting
Events —
0
No Featured Media 2014-10-21 @ 06:30 am 2014-10-21 @ 06:30 am [event id="2397"]
Select 10-14-2014 Breakfast Meeting
10-14-2014 Breakfast Meeting
Events —
0
No Featured Media 2014-10-14 @ 06:30 am 2014-10-14 @ 08:30 am [event id="2393"]
Select 10-17-2014 Trap Shoot
10-17-2014 Trap Shoot
Events event
0
ArmySkeetShooterCrop2 2015-01-14 @ 08:00 am 2015-02-18 @ 12:00 pm [event id="2385"]
Patrickat 6:17 pm

@RobertKwasny Yup, I see 'em in the admin
RobertKwasnyat 6:17 pm

@RobertKwasny Aha! I think we may have stumbled upon a bug#

Patrickat 6:20 pm
I can access the individual events, but cannot see them as an archive on your upcoming-events page

RobertKwasnyat 6:20 pm
Wow! I'm added Tags to each Event as a possible work around

RobertKwasnyat 6:21 pm
That's not doing it :slight_frown:

Patrickat 6:21 pm
@RobertKwasny Lemme try activating the Special Pages addon which has logic for archive pages, etc

Patrickat 6:24 pm
Nope, no joy there

RobertKwasnyat 6:25 pm
OH CRAP, I'm supposed to be going live in a few days... How's the bug fix situation work, never encountered one in WPMUDEV before

RobertKwasnyat 6:27 pm
I tried to get Membership working, then on advice from one of your staff members abandoned it for Protected Content because Membership wasn't as good as PC... but those Events worked in Membership... this is not good news

RobertKwasnyat 6:28 pm
Uggh, what would you write to him... what did you discover?

@RobertKwasny That's done via the forums. Create a topic describing the issue and support staff will flag it as a bug which notifies the plugin developer and reminds him with emails and notifications until the task is completed :slight_smile:

Patrickat 6:29 pm
Individual posts of a custom post-type can be accessed when granted in the membership, but the post-type archive page cannot. Include a link to your movie (with popcorn this time please)

RobertKwasnyat 6:31 pm
OK, thanks Patrick! I'm collecting up this thread and will clean it up for the Ticket... thanks for discovering the bug!

@RobertKwasny BTW, I just did a quick test on my site with our Events plugin and the bug is confirmed: no access to the CPT archive

  • Patrick

    Hey there @RobertKwasny & @Vinod Dalvi

    Yup, that is correct, the custom post-type protection is buggy in Protected Content.

    Further testing this morning on my test site revealed inconsistent results, having tested various combinations of URL Group rule for CPTs, Special Pages rule, and Post-by-Post for CPTs.

    Access to individual posts and CPT archives were granted on all membership types on my test setup in all variations of rules. However, some membership types would have access to single posts but not archives, while other types would have access to archives but not single posts.

    I've flagged the developer on this issue and will make myself available for further testing and debugging with him as soon as he can dig into this.

  • RobertKwasny

    @Patrick @Vinod -- Guys -- thanks for giving this the attention (I, We, Client, Members of the Organization) needs!

    Please don't hold it against me if I do some nagging here... Membership Plugin is what I started with and was so delicate that the suggestion _- the recommendation came from Live Support -- to switch to Protected Content came way late in the game...

    The Schedule for the presentation is Tuesday Morning 7:00am on Jan. 13th...

    Sweating Bullets in Albuquerque!!

    Four days, but two are weekend days -- have my fingers crossed this is way simple for either the Event or the Protected Content Developers to resolve.

    Have both developers been engaged to resolve the problem or are you already certain that the issue is in one of the two plugins?

    Thanks in Advance!!!
    R

  • Philipp Stracker

    Robert,

    I have good news for you today :slight_smile:
    We have checked the issue and found the problem. It will be officially fixed in version 1.1, which is coming soon.

    Since you need the solution before that date, I'll give you instructions to fix it yourself - it's actually quite simple. But first let's go over the correct plugin configuration quickly:

    Plugin configuration (tested with plugin version 1.0.4.9)
    - Add-On "Custom Post Type - Post by Post" must be *inactive*
    - Add-On "Special Pages" must be *active* but *no rules* defined for a special pages
    Important: Do NOT try to protect the Archive page via the Special Pages rule
    - In Protected Content page I protect the Custom Post Type "person"

    Result:
    - Guests cannot access either the archive (/person) nor any post (/person/name)
    - Members however can access both pages, but the archive page shows no posts.

    Fix the Archive page for members
    You'll need to make a small modification to a plugin file - this change is included in the next release, so don't worry about this :slight_smile:

    Open file
    wp-contents/plugins/protected-content/app/model/rule/class-ms-model-rule-custom-post-type-group.php

    In line 92 you see this code:
    if ( $apply && ! parent::has_access( $post_type ) ) { $apply = false; }

    Simply remove the ' ! ' and save the file. The correct line looks like this:
    if ( $apply && parent::has_access( $post_type ) ) { $apply = false; }

    After this change your Members will also see items in the archive page!

    Let us know in case you need help with the change, we'll be happy to make the change for you! Currently the Support-Staff-Login does not work, otherwise I would have edited that file for you already

    Thanks, Philipp :slight_smile:

  • RobertKwasny

    @Phillipp and @Patrick -- NICELY done boys!
    Funny, after writing and supporting code since 1976 myself... one NEVER get's used to just ONE extra character that is either missing or extra!

    !
    :wink:

    Thanks for digging in and getting to the root of this so quickly... I was completely occupied with out of town clients for the last two days and was totally and completely pleased to find this cure in my inbox.

    Well done team, well done!

    My Tuesday morning rollout -- can now go out without a hitch!

    With much appreciation!

    R

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.