paid-memberships-pro
paid-memberships-pro copied to clipboard
Add "Non-members" option to the level restrictions for builders like Beaver Builders, Elementor, Divi.
Our membership shortcode and blocks have a "Non-members" option, but the settings we've added to builder sections/elements/blocks doesn't have this option.
For example, with Beaver Builder, we add the options for the level setting here: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/compatibility/beaver-builder.php#L27-L32
We could add an option to the top with value "0" and label "Non-Members".
We could also add "L" for "Logged-out Members" only, which we don't even do for our block. But it should "just work" since we pass the value to the pmpro_hasMembershipLevel function which can handle "L" as a level value.
We would need to be careful about the "0" here and make sure that these sections don't default to the Non-members value, and make sure that the "0" value saves when chosen instead of looking "empty" to the builder when the settings are saved.
(Honestly, this is probably why we didn't include this initially.)
A work around to the zero problem would be to use a different value for non-members (N?) and save that. Then in our code that checks swap out any N for "0" (I put that in quotes, but not sure if the PMPro function expects or cares if it's a string or int, just needs to be 0 and not another empty value.)
A customer (Mods: #531303) requested this feature.