User Role Widget Areas

Have you ever wanted to use WordPress create a password protected member website? User Role Widget Areas is a new plugin that I recently developed to make this process just a little bit easier. It gives you the ability to leverage user role based sidebars and widget areas to selectively display content.

Why I Built the Plugin

Not too long ago, I began using WordPress as more than just a simple content management system. This came after numerous client requests to design and build sites that had integrated user / membership systems. I needed a solution where different users were presented different role based widget areas for displaying things like user role specific menus. I achieved this by hard coding I bit of conditional logic into my themes that would allow for it. Well, after I had done this a dozen or so times, I decided there had to be a better way. So I began looking for a plugin that offered the same capability. To my surprise there were none that actually worked. It was at that point I decided to build my own.

What the Plugin Does

Simply put, User Role Widget Areas (URWA) allows you to selectively display content in your themes active sidebar and widget areas to logged in users who have been assigned to one of the default WordPress user roles – Administrator, Editor, Author, Contributor or Subscriber. Users that have not been assigned to one of the default roles or are not logged in, cannot view the content of the role based widget areas.

urwa-screenshot-1

To take that a step further, I added two user status based widget areas for displaying content to either all logged in users or all logged out users. This is particularly handy if you wanted to show a message to all users within the system once they are logged in or if you wanted to have a registration widget display only for those users who are not logged in.

urwa-screenshot-2

Plugin Setup and Usage

Setup of User Role Widget Areas is fairly straightforward. It should only take you a few minutes to configure. Here are the steps you will need to take to set it up and some tips to help with the process of testing the plugin.

[wc_tabgroup layout=”box”] [wc_tab title=”Step 1″]

Installation and Activation

Install the plugin. To do this, log into your site and use the default WordPress plugin installer. Or if you prefer, you can download the plugin from the WordPress repository and upload it to the plugins directory of your site via FTP. Once the plugin is installed go ahead and activate it.

[/wc_tab] [wc_tab title=”Step 2″]

Adding your User and Role Based Widgets

Go to the  Appearance > Widgets menu and drag some widgets into the new User Role-based or Status-based widget areas. When testing it can be helpful to simply drag a text widget into each new widget area and give each a corresponding title. For example: Drag a text widget into the “Users – Administrators” widget area and give it a title of “Administrator Widget”.

[/wc_tab] [wc_tab title=”Step 3″]

Displaying your User and Role Based Widgets

Now you will need to drag the provided display widget(s) (URWA – Users by Role or URWA – Users by Status) into any of your theme active widget areas or sidebars. This will display the widgets you just dragged into the User Role-based or Status-based widget areas. Please Note: If you skip this step the widgets will not appear on the front end of your site.

[/wc_tab] [wc_tab title=”Step 4″]

Viewing your User and Role Based Widgets

Log In to WordPress as a user(s) with different user roles to see your  Role-Based and Status-based widgets appear on the front end of your site. If you don’t see them appear, simply refresh your browser. In order to test the other roles you will need to have users assigned to those roles. I find it useful to create a test user that I can use to cycle through the various user roles.

[/wc_tab] [/wc_tabgroup]

Theme and Plugin Compatibility

To ensure theme compatibility, I built the plugin so that it uses separate display widgets to output the content of both the user role based and status based widget areas. This means that it can be placed in any of your themes active sidebar or widget areas ensuring it works with nearly every theme. Since this plugin doesn’t use any javascript, it plays nice with other plugins, more specifically membership plugins. By itself it’s pretty powerful but when you pair it with other membership plugins such as the ones listed below that is where it really shines. If your interested in grabbing a copy of it you can download it from the WordPress Plugin Repository using the link below.

This plugin has been tested and works with the following membership plugins as well as many more:

Ultimate Member

User Profiles Made Easy (UPME)

WP Members

Restrict Content Pro

Users Ultra

5

Comment

There is no comment on this post. Be the first one.

What's on your mind?

Pin It on Pinterest

Share This