Support only during business hours : Monday to friday, from 8:30 am – 5:30 pm CEST

Due to the decrease in our staff due to vacations, our response time may be longer.

Be sure we're doing our best to manage your topic as soon as possible.

restrict content access to users

This topic is resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • alex
    Participant
    • 81 Topics
    • 259 Posts
    @abourne

    I wish to restrict access for non-members/unregistered to open a post, but still be able to see the page for where all the posts are as tiles.

    I.e.

    Be able to view: https://www.gymn.com.au/benefits/ which is the blog page
    But restricted content access to the post: https://www.gymn.com.au/benefits/support-when-you-need-it/

    I spent countless hours and seemingly tried every available plugin – most of which break the registration procedure or cause fatal errors…

    What function or filter can be used?

    Note: I cannot use a shortcode on each post. It must instead be a generic option to restrict every post to unregisted users.

    alex
    Participant
    • 81 Topics
    • 259 Posts
    @abourne

    Note: PMP does not suffice. It excludes the entire page, not the posts themselves. We still need to allow access to the page. No such options comes with PMP.

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @abourne,

    This seems odd because one of the basic features of PMPRO is to be able to prevent access to a content (a post) according to a plan:

    However, you can try this simple snippet:

    /**
     * Redirect non logged-in users to registration page if they visit a single post page
     */
    function user_single_page_template_redirect()
    {
    	if( ! is_user_logged_in() && is_singular( 'post' ) ) {
    		wp_redirect( home_url( '/register/' ) );
    		exit();
    	}
    }
    add_action( 'template_redirect', 'user_single_page_template_redirect' );

    Best regards,

    alex
    Participant
    • 81 Topics
    • 259 Posts
    @abourne

    Countless hours spent looking through and trying plugins and random snippets from forms…. I’m thankful for your solution.

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    You’re welcome. ?

    Best regards,

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘restrict content access to users’ is closed to new replies.

Troubleshooting Demo Imports

You're trying to setup your theme but you're experiencing errors when importing the demo content? Or you've just followed the setup guide but your website doesn't look exactly like our demo? These are common issues for which you can find easy and quick fixes.

Happy With our Support So Far?

Feel free to review our theme on Themeforest! It helps us making our products more known to new potential customers, which allow us more time to improve the quality and develop new features. #SharingIsCaring ❤️

Discover MatchPress

Skip • Like • Super-Like

Add powerful matching features like Member likes, skips, super likes, conditional private messaging and much more.

Setup Your Cera or Gwangi powered Community Website and Turn it into an iOS and Android App

15% discount for Cera users

To unleash the full power of your Cera or Gwangi theme, we have partnered with the Zipline team. Your community website can now be fully setup and turned into your very own custom app for iOS and Android.

Whether you've newly acquired the theme or already got your site up and running, Zipline got you covered. And we got you an incredible discount.

Holiday, Weather & Festive effects
to pimp your WordPress Site