Seeking a User Role Plugin

A client of ours is currently using Rolescoper as a WP plugin to manage users' access to various "private" pages and posts. However, Rolescoper hides posts/pages from view unless the user is logged in. We're looking for a plugin that shows all the posts/pages but shows a "access denied" message with a prompt to log-in afterwards.

Here's a list of the requests verbatim:

  1. Create User Account: username/password
  2. Assign user to a page that is private
  3. I want the private page to still appear in the navigation, even though a user may not be logged in.
  4. Once a private page is clicked, they are prompted to enter their username/password. Once they do, they are then redirected to that page.
  5. This would also need to be applied to document uploads

Any ideas? I did some Googling/WP plugin searching without much luck.

Thanks!

Solutions

Maybe rather than using a plugin, try reworking your template to use is_user_logged_in?

I know this is a very old question, but for anyone else who finds it, I'll take a swing.

You could add to the beginning of your while statement in your single.php file a "Private" category check and "User Logged In" check, like so (NOTE: redirects to login page if user not logged in and category on post is set to "private"):

while ( have_posts() ) : the_post();

        if(in_category("private")){

            if(is_user_logged_in()){

                get_template_part( 'content', get_post_format() );

            } else {

                auth_redirect();

            }

        } else {

            get_template_part( 'content', get_post_format() );
        }

Is User Logged In?

In Category X?

See also: auth_redirect()

Hope this helps!

Tags: PHP / Mysql / Wordpress

Similar questions

Let new user role to 'edit_others_posts' of other user role, not of its own type
In my system, I'm making two new roles: My CPT 'capabilities' parameter is revamped using 'map_meta_cap' => true like: Scenario is: TP can add their contents freely, but can't publish. DEOs can add their contents freely too, and additionally DEOs can edit/modify TP's contents, and finally can publish 'em. But they (DEOs) can't touch each other's...
How to allow an user role to create a new user under a role which lower than his level only?
I have three extra roles in my site. those roles are added by following code: By default Administrator role create all other roles. But I want to limit this assigning role by user level. What I mean is: How can do this? Better if I can achieve this without using any plugins.
Create custom user role (client) that can create another custom user role (employee) of that client
Bit of a long question, but I do believe this situation will occur for other people in other contexts. Our company needs to create an Employee Assistance Program MU subdirectory network site where our company can create user accounts with a custom user role of client. The client will be another company needing to use our company's EAP services for ...
Button for users to upgrade their user role + Button to show current user role!
I have a blog with different user roles and therefore different user permission levels. From time to time, I would like to give my registered users the possibility to upgrade their current user role ("subscriber" to "premiummember") for free, but I don't want to do this for every user who wants to be upgraded manually. I thought that it would be ni...
Copy user role on multisite so the user can access subsites with same role
I have a multisite network set up with around 250 sites. I'd like to be able to copy users with their assigned role from the main site in the network to subsites. Here is how I attempted to do this: functions.php This has been tested and works when a user visits the subsite THEN proceeds to log in. If they attempt to log in directly, they receive a...
How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
I have 500 users with 50 of those users assigned to user-role XYZ. I'd like these 50 XYZ users to keep their current XYZ user-role but also be assigned another/additional/extra/second user-role ABC... as a bulk job. I'm looking for a function that could

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.