This topic has 7 replies, 2 voices, and was last updated 7 years by Laura.

  • Author
  • #202191
     hamsar
    Participant

    Hi again,

    I m using a snippet which blogs non members to access certain pages. However its also blocking blog posts. I did allow the blog page however its not accessible to non members. Thanks

    Thanks

    AB

    #202192
     hamsar
    Participant

    Hi again,

    I m using a snippet which blocks non members to access certain pages. However its also blocking blog posts. I did allow the blog page, however blog posts are not accessible to non members.

    Thanks

    AB

    #202200
     hamsar
    Participant

    is there a snippet where i can allow blog post to be viewed and indexed. thanks

    #202225
     Laura
    Moderator

    Hello, it depends, if your plugin also blocks them to be indexed you won’t be able to index them.
    Have you tried paid membership pro? It let’s you individually block posts for certain user levels but they are indexed

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #202230
     hamsar
    Participant

    Hi LAURA,

    I m using this snippet and its blocking the post to be viewed by non logged users. But I want to allow post to be viewed by non logged users. How can i make it happen. Thanks

    /* Restrict guests only to those pages.*/
    function sq7R_kleo_restrictions_guest_restrict() {
    $allowedpages= array(‘register’,’activate’,’Home’,’blog’,’reasons-to-join’,’privacy-policy’,’about-us’,’terms-of-service’,’contact’);
    if( !is_user_logged_in() && !is_page($allowedpages)) {
    wp_redirect(site_url( ‘/register’) );
    }
    }
    add_action(‘template_redirect’, ‘sq7R_kleo_restrictions_guest_restrict’);

    #202343
     Laura
    Moderator

    Hello, replace it with this and let me know if it works

    COPY CODE
    
    /* Restrict guests only to those pages.*/
    function sq7R_kleo_restrictions_guest_restrict() {
    $allowedpages= array(‘register’,’activate’,’Home’,’reasons-to-join’,’privacy-policy’,’about-us’,’terms-of-service’,’contact’);
    if( !is_user_logged_in() && !is_page($allowedpages)) {
    wp_redirect(site_url( ‘/register’) );
    }
    }
    add_action(‘template_redirect’, ‘sq7R_kleo_restrictions_guest_restrict’);
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #202368
     hamsar
    Participant

    Hi ,

    It works but now its not redirecting users to the registration page rather they are redirected to the membership level page. I want non logged to be redirected to the registration page. thanks

    Thanks

    #202424
     Laura
    Moderator

    Hello, if you block blogs they will be redirected but you don’t want to block blogs so they are able to see it and not be redirected. It’s one thing or the other

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?