This topic has 6 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #167354
     vidjaylee
    Participant

    Hi,

    i use this code to redirect guests to register page.

    <?php
    /**
    * Restrict users to your site and redirect them to register page
    * @author SeventhQueen
    *
    * @return void
    */
    function sq_restrict_my_website(){
    global $pmpro_pages;
    if(!is_user_logged_in() && ( function_exists(bp_is_active) && ! bp_is_register_page() ) && $GLOBALS[pagenow] !== wp-login.php && ( !empty( $pmpro_pages ) && !is_page($pmpro_pages) )){
    wp_redirect(wp_registration_url());
    exit();
    }
    }
    add_action(template_redirect, sq_restrict_my_website);

    I would like to show a message in register page only after the redirection, i’m noob in javascript

    #167430
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #167710
     Radu
    Moderator

    Hi,

    What’s the page URL where user it’s redirected if done’t have mermbership ?

    In this way, i can do a condition and to add a message to that page via PHP.

    Let me know
    Cheers
    R.

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

    Hi,
    The page url is /inscription

    #167836
     Radu
    Moderator

    Hi,

    Add this code to functions.php

    COPY CODE
    
    function check_is_register_page() {
        if(is_page('register') && !is_user_logged_in()) {
            echo 'This is my custom message for the register page for guest users';
        }
    }
    add_action('bp_before_signup_profile_fields', 'check_is_register_page');
    

    It will display a message for guest users. Message by referring location isn’t possible at this moment.

    Cheers
    R.

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

    It will help for now,
    thank you

    #168206
     Radu
    Moderator

    You’re welcome

    Cheers
    R.

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

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?