Setting up Protected Content plug in

Hi, I don't know if it's me being dense or that it's a Saturday evening & I'm supposed to be going to a party but... I cannot get the Protected Content plug in to do what I want it to do!
I'm setting up a website for a training company. They do a lot of their stuff online, distributing course materials, pdfs video etc.
I would like for my client to upload the files as media, then as one of their clients purchases the training, they create a post with the related media attached. That post is then only available to a specific membership.
What I was envisaging for this plug in, is that my client set up a membership per company that they provide training for. Then set up a wordpress user for each person in the company taking the training. I thought I would then need to make each user a member of whichever membership/company they were part of.
However, none of this seems to work in the way that I'm envisaging. Have I got the right understanding of how the plug in works?

  • Michelle Shull

    Hey there, Barnaby!

    I think you're probably almost there, we can totally do this with Protected Content. : )

    What I would do is assign each company a Category. All posts for that company will be listed under the category assigned to them, then you can protect all your post content by category. So let's say you have five companies:
    Bob's Widgets
    Sue's Widgets
    Dan's Widgets
    Widget Emporium
    Widget-o-Rama

    You'd create five categories, one for each.

    Then, in protected content, you'd add category protection to each category.

    Next, set up your Memberships, one for each company.

    Now, make sure each membership has access to their specific category, but no other categories. (and any other parts of your site you want them to see.)

    That should do it for you, I think?

    Let me know if this isn't clear, I can go into more detail!

    Thanks, Barnaby!

  • Barnaby

    Hi Michelle,
    Sunday afternoon web development!
    Thanks so much for your help yesterday, I abandoned it & went for a dance at a party instead!
    So, I have created the following:
    3 memberships, eBay, Google & General Electric (thought I'd aim big).
    Post category for each of eBay, Google & General Electric.
    Users to test for each category, johnsmithebay, jamessmithgeneralelectric & juliesmithgoogle.
    I've added each of the above users as a member.

    However now, I can't seem to add the post categories to the memberships or add the members to the memberships. Please can you help with this bit?

  • Barnaby

    Hi Tyler,
    I seem to have fixed the first part of the problem. It seems that because I hadn't assigned any categories of protected content to the memberships, I couldn't assign members to the membership. Is that expected behaviour?

    The next bit I am struggling with now, is that I have created a load of pages, that all work fine, apart from one.
    I've created a page called 'Training Portal' in which I have included the loop on to get the posts. I have also protected the page.
    I've included a 'Log In' link to the 'Training Portal' page in the footer. The idea being that when you click on 'Log In' it gives you a prompt to log in, then shows all the posts for the category that the user has access to.

    How do I do this?

  • Barnaby

    Hi,
    Can anyone help please? I'm getting really frustrated with this plugin, I'm sure this is down to my ignorance.
    I'm set up as the overall Administrator for my client's website. I have used a third party plugin to create different types of users. I have made my client a kind of semi administrator, where they can create users & posts & upload media.
    I have the following requirements:

    Client to be able to upload content (posts & media) specific to a membership.
    Client to be able to create posts with links to media, to specific memberships & posts that go to all memberships.
    Client to be able to create memberships & add members to the memberships.
    Members log in & be shown a list of the posts for their specific membership, so they can view the media assigned to them.
    Members can view public pages & a page of their posts & none of the account details or registration.

    Please help, I have ground to a halt with this. I'm contemplating uninstalling the plug in & searching for something else.

  • aristath

    Hello again @Barnaby, I hope you're well today!

    What I have left to achieve is:
    User logs in through a link & is then taken to the posts page which only shows a list of posts that are in the category that is assigned to the users membership.

    You can do the following:
    1. Create a page, and add 3 lists of posts there (one for each membership) using this plugin: https://wordpress.org/plugins/display-posts-shortcode/
    2. Wrap each of these shortcodes in a membership shortcode.
    3. Use this plugin to redirect users to that page when they login: https://premium.wpmudev.org/project/login-redirect/

    I hope that helps!

    Cheers,
    Ari.

  • aristath

    Hello again @Barnaby,

    Could you give me a step by step on how to work out steps 1 & 2 please?

    First, from your dashboard go to Membership => Access Levels.
    On the list of the access levels, you will see on the right a column called "shortcodes" (see attached screenshot). If you hover the ( i ) icon there you will see info on how to use the shortcodes

    Then, create a page. You can do that from your dashboard by going to Pages => Add New.
    Enter a title for that page.
    On the content of the page you can enter something like this:

    [level-my-level-1]
    THIS WILL BE DISPLAYED ON USERS OF LEVEL 1
    [/level-my-level-1]

    [level-my-level-2]
    THIS WILL BE DISPLAYED ON USERS OF LEVEL 2
    [/level-my-level-2]

    [level-my-level-3]
    THIS WILL BE DISPLAYED ON USERS OF LEVEL 3
    [/level-my-level-3]

    I hope that helps!

    Cheers,
    Ari.

  • Barnaby

    Hi Ari,
    Before continuing, I just wanted to say thank you for your help so far & also for your help on my theme issue, you recommended on the live support chat I use _S theme & it worked a treat.
    Anyways, I think I have probably expressed myself badly.
    I want the site to work with myself as the administrator & one of my clients as a kind of lesser administrator (let's call him Luke) who can't create pages but can create posts & users. The posts will contain training materials that are specific only to certain users.
    I would like Luke to create posts, create users & memberships & select which members they are available to.
    When the users log in, they will only ever be subscribers. I would like all of the users to log into one page that has already been created. The posts however would only be visible to users that are part of the correct membership.
    So if I or Luke log in, we can see all the posts on the blog page (let's call it training portal page)
    When a certain user logs in to the training portal, I want only the posts for the user's membership to be visible. So if there was a membership for a company, (let's say General Electric), I want the users who are part of the General Electric membership to see only the posts for General Electric.
    Is this even possible?

  • aristath

    Hello again @Barnaby,

    First you will have to do the following:
    1. Install this plugin: https://wordpress.org/plugins/user-role-editor/
    2. From that plugin, create a new user role and assign the permissions you want Luke to have.
    3. From the Membership plugin, add Luke as a membership administrator.
    4. Create an access level for General Electric and build it so that the people that are part of General Electric have access to the content that you want.
    5. Create a subscription for General Electric and assign the General Elelctric access level to that subscription.
    6. I think that's all... Now Both Luke and yourself will be able to add the General Electric subscription to the users you want and they will have access to the content you have specified from their access level.
    Of course you will have to create different access levels and subscriptions for all the companies like GE that you want to have.

    I hope that helps!

    Cheers,
    Ari.

  • aristath

    Should I be using the Membership plugin rather than the Protected Content plugin, that I'm currently using?

    I'm terribly sorry, I only read your previous post and missed the original post were you mentioned you're using Protected Content.

    You can do it with Protected Content too...
    This is what will have to be done:

    1. Create a membership level for General Electric and build it so that the people that are part of General Electric have access to the content that you want.
    2. Make luke an administrator on your site.
    3. Custom-code the permissions for Luke so that he only has access to the areas of your dashboard that you want him to.
    Something like this should work: (I'm assuming here that Luke has a user ID of 38 which is completely random)

    <?php
    
    /*
     * Hide admin menus for user 38
     */
    function custom_remove_admin_theme_remove_menus () {
    
        $current_user = get_current_user_id();
    
        if ( 38 == $current_user ) {
            global $menu;
            $restricted = array(_
                __( 'Media' ),
                __( 'Links' ),
                __( 'Pages' ),
                __( 'Tools' ),
                __( 'Settings' ),
                __( 'Comments' ),
                __( 'Plugins' ),
            );
            end ( $menu );
    
            while ( prev( $menu ) ) {
                $value = explode( ' ',$menu[key( $menu )][0] );
                if ( in_array( $value[0] != NULL ? $value[0]: '', $restricted ) ) {
                    unset( $menu[key( $menu )] );
                }
            }
    
            remove_menu_page( 'edit-comments.php' );
            remove_menu_page( 'themes.php' );
            remove_menu_page( 'plugins.php' );
        }
    }
    add_action('admin_menu', 'custom_remove_admin_theme_remove_menus', 10);

    I hope that helps!

    Cheers,
    Ari.

  • Barnaby

    Hi Ari,
    I have got Luke set up with correct user permissions now, the code you gave me, flagged up some script errors but I found the User Role Editor plug in & that got it working correctly.
    Anyways, I have done the following:
    Created 3 memberships, eBay, General Electric, Google.
    Created 3 post categories, named the same as the memberships above.
    Created 3 users, johnsmithebay, jamessmithgeneralelectric, juliesmithgoogle.
    Created 3 members for the above users & assigned them to the corresponding memberships.
    Assigned the page 'training-portal' as the blog page in settings.
    I have protected the training-portal page in the 'Protected Content' plugin & also protected the three categories of posts.

    So far so good, I think(?) but when I log in as one of the users above, it shows all the posts in the blog, rather than just the ones they have been assigned. Where am I going wrong?
    Cheers,
    Barnaby

  • Michelle Shull

    Hey Barnaby!

    Yep! Then check your memberships by going to Protected Content > Memberships, and make sure the toggles for the memberships you want are green, as well.

    If that's all set, would you mind letting me take a look under the hood with support access? If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings from the following path and reply on this thread after granting it?

    Admin -> WPMU DEV -> Support -> Support Access Tab

    If you have not installed WPMU DEV Dashboard plugin yet, kindly do that here : https://premium.wpmudev.org/project/wpmu-dev-dashboard/ and then allow access as per the above process.

    Thanks Barnaby!

  • Michelle Shull

    Hey there, Barnaby!

    I see the issue on your site, and right now, that's how Protected Content is designed - category protection doesn't cover the excerpts on the blog (training portal) page.

    But! I just thought of a workaround. Instead of using the Training Portal as the blog page, what if we rely on category archive pages, instead?

    On the portal page, instead of showing all the blog posts, you could link to the archives for eBay/Google/etc. (yoursite.co.uk/category/ebay/) If you only want eBay members to see the eBay link, you could wrap that link in membership specific shortcodes. (You can see those on the Memberships page)

    Your individual training video posts are all protected and working properly, I used the Protected Content membership test tools to check each one against each membership level, so I think it's just a matter of being creative with your training portal page.

    Thanks, Barnaby!

  • Barnaby

    Hi Michelle,
    Thanks for getting back to me & taking the time to have a look at the site.
    I understand what you are saying & can see how this would work, however I don't want my client 'site administrator' (named Luke, from previous posts) to have the ability to create or edit pages, which he would need to do to add links to the categories on the training portal page.
    As you'll have seen, I have used some pages to create the static content for the rest of the site & I don't want Luke to have the access to mess these other pages up!
    Would it be possible using the protected content plugin, to maybe give Luke edit access to just the training portal page & I could show him how to write the code for each membership?
    Thanks again

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.