pmpro-cpt icon indicating copy to clipboard operation
pmpro-cpt copied to clipboard

Doesn't work with MMPU

Open ideadude opened this issue 6 years ago • 4 comments

The code to redirect always redirects away even when you should have access.

Create 2 levels. Give yourself both levels. Mark one CPT post to require one level. Mark another CPT post to require the other level. Navigate to either CPT page.

The the_content filter still works well on archive views (probably because it's just core PMPro and MMPU).

ideadude avatar May 01 '19 17:05 ideadude

Screen Shot 2019-05-01 at 1 11 39 PM Screen Shot 2019-05-01 at 1 12 17 PM

itsjusteileen avatar May 01 '19 17:05 itsjusteileen

Here is where it checks if someone has access to the current page before redirecting away: https://github.com/strangerstudios/pmpro-cpt/blob/master/pmpro-cpt.php#L51-L54

This should respect MMPU but is failing for some reason.

ideadude avatar May 01 '19 17:05 ideadude

In my tests, I found it was actually the pmpro-email-confirmation plugin which was filtering pmpro_has_membership_level so I THOUGHT a user had a membership level but they really didn't. The pmpro-email-confirmation plugin may be the one that needs to be updated to work with MMPU. I thought it had logic in there to not require an email confirmation if an admin gave a user a level/etc. That might not be firing with MMPU active.

ideadude avatar May 14 '19 04:05 ideadude

Yeah, note here

https://github.com/strangerstudios/pmpro-email-confirmation/blob/dev/pmpro-email-confirmation.php#L173-L182

and here

https://github.com/strangerstudios/pmpro-email-confirmation/blob/dev/pmpro-email-confirmation.php#L203-L212

It's assuming one level. pmproec_isEmailConfirmationLevel should be updated to accept an array of level ids or level objects.

Then the check in the 2 has membership level callbacks should use pmpro_getMembershipLevelsForUser() (plural version) to get all of a user's levels to be checked.

ideadude avatar May 14 '19 04:05 ideadude