Site logo

Archived topic

Suggestion : Disable Element "Full Page/Post content"

6 replies · Started by Benjamin on November 26, 2020

Viewing posts 1–7 of 7

Hello,

GP is one inch away of providing a pretty useful function : display/hide (page/post) content based on User Role.

It has everything except the option to select "Full Page/Post content" in the disable elements window:

https://dropshare-files.s3-eu-west-1.amazonaws.com/Screen-Shot-2020-11-26-16-15-48.jpg

this way we could protect the entire page content to be viewed based on user role.

Thanks for evaluating the idea,

Hi there,

try this instead, create a new Hook Element or Block Element.
Select the Hook > Custom Hook and add: generate_do_template_part

You can either leave the Hook/Block content empty or add your own custom content for protected pages.

Then set your Display Rules

Thanks for he suggestion, looks like it could indeed work to show/hide the content if needed.

However it looks like the Display Rules won't allow me to do what I need:

I wanted to be able to have basic membership level and display rules made with solely GP.

e.g. if logged-in User Role is NOT (Membership1 OR Membership2) OR user is not logged in => display "please log in or buy a membership" else display the normal loop content.

TBH I've always wondered why the GP display rules aren't more developer friendly (like the Widget Logic plugin, e.g. is_page() && is_logged_in())

The Display Rules aren't that complex, unfortunately. Once you start adding in OR and AND conditions, things start getting pretty messy.

It would be sweet to introduce a way to add your own conditions as you've mentioned. Not sure what that would look like when it comes to UI, but it's worth exploring. Noted :)

"Not sure what that would look like when it comes to UI, but it’s worth exploring."

I think you could offer a simple field like the "Widget Logic" UI, where people could enter pure WP conditionals, like so:

https://dropshare-files.s3-eu-west-1.amazonaws.com/Screen-Shot-2020-11-27-21-57-06.28.jpg

Maybe hide this field under an "Advanced configuration" and indicate that what is entered in that field overwrites any configuration made with the "Location/Exclude/Users" UI fields.

Humm, actually there is no WP conditionals to check if the current user belongs to a give Role, so in my case even if GP allowed advanced rules, it wouldn't work...

This archived topic is closed to new replies.