6.4 Protecting Widgets

Created by Danny Wong, Modified on Sun, 09 Aug 2020 at 02:46 PM by Danny Wong

If you want to show/hide certain widgets depending on what the currently logged in member has purchased, then follow the steps below.

Step 1

Download and install the Widget Logic plugin.

Step 2

Widget Logic adds a new field to the bottom of every widget like this:

Step 3

Setup a Rule for the widget and set the Rule type to "Partial" - then click on the "Partial Content Codes" button and copy the text in the red box in this image:

NOTE: if you don't want to create a rule, you can use current_user_can('mepr-active','membership:123') in step 4, where 123 is the unique membership id. If you would like to learn more about how to do this click here.

Step 4

Find the widget(s) you want to hide from unauthorized members, and paste the code you copied in step 3, into the Widget Logic box for this widget:
Note: Each Rule has it's own unique ID (388 in the example above) so be sure that the ID is correct when you paste the partial content code into the Widget Logic settings on your widgets.

Step 5

Save the widget. It will now be hidden from members who do not have access.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article