Some asked an excellent and reasonable question:
How to protect sidebar data for the membership site?
The problem is that premium content markers { +++ } does not work within sidebar content. But the task can easily be solved with the help of free, simple and powerful Widget Logic plugin.
The sequence of steps to create a premium-only sidebar widget would be like this:
- Install and activate Widget Logic plugin
- Go to Appearance->Widgets
- for the sake of this example let work with Text widget – drag and drop “Text” widget to the sidebar of choice.
- Title it “Premium sutff” of whatever you want.
- Inside of it put text: “This is my premium and very valuable text”
- Note “widget logic” field available at the end of this widget dialog. (It will be available for every widget as Widget Logic plugin is installed).
- Paste in this field the following code snippet:
return (current_user_can ('edit_users') || current_user_can ('read_platinum'));Above snippet will show this widget only to administrators and “Platinum” premium members.
Cool? Yes! - Press button [Save] and link “Close”.
- Now reload your blog – and you’ll see your premium widget – because you’re admin. Logoff and create some “Platinum Member” user (that is if you’re using MemberWing). Then login as new platinum member – and you’ll see your widget. Logoff and login as gold member – and you’ll not see it.
- Here are variations of the code to paste into “widget logic” field to make the widget premium and be shown only to certain levels:
- Bronze level: Visible to Bronze, Silver, Gold, Platinum members only:
return (current_user_can ('edit_users') || current_user_can ('read_bronze') || current_user_can ('read_silver') || current_user_can ('read_gold') || current_user_can ('read_platinum')); - Silver level: Visible to Silver, Gold, Platinum members only:
return (current_user_can ('edit_users') || current_user_can ('read_silver') || current_user_can ('read_gold') || current_user_can ('read_platinum')); - Gold level: Visible to Gold, Platinum members only:
return (current_user_can ('edit_users') || current_user_can ('read_gold') || current_user_can ('read_platinum')); - Platinum level: Visible to Platinum members only:
return (current_user_can ('edit_users') || current_user_can ('read_platinum'));
You may also add another pieces of logic into the snippet, such as is_page() to show the widget only to premium users that are viewing pages, but not posts. Sky is the limit!




































