BuddyDev

Search

show a message after wp_redirect function

  • Participant
    Level: Enlightened
    Posts: 26
    Ahmed on #9899

    hi,
    i use this function to redirect bp pages visitors to register page

    add_action( ‘template_redirect’, ‘yoostart_page_template_redirect’ );
    function yoostart_page_template_redirect()
    {
    //si pas connecté et demande pages bp excepté inscription et activation
    if( ! is_user_logged_in() && ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) {
    wp_redirect( home_url( ‘/register/’ ) );
    exit();
    }
    }

    i would like show a message in register page only after redirection, how can i do it?
    I’m noob in javascript

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #9906

    Hi Ahmed,
    You may change

    
    
    wp_redirect( home_url( '/register/' ) );
    
    

    to

    
    
    wp_redirect( home_url( '/register/?ref=xyz' ) );
    
    

    and in the register.php

    you can check for the $_GET[‘ref’] and if it is your token, you can show the message.

    You won’t have to use any javascript for this.

    Hope that helps.

You must be logged in to reply to this topic.

This topic is: not resolved