• Resolved originalpiratematerial

    (@originalpiratematerial)


    Hi

    Is it possible to set a different redirect depending on where the shortcode is placed? I’m happy using a functions.php snippet if need be

    1) On the general sign in page, I want it to redirect to the /member page on login
    2) I also have the sign in shortcode in an error message if the user doesn’t have permission to view a page. If they sign in there, I want them to see that page

    If I turn off redirect I can get 2) and if I turn on redirect I can get 1) but not both together!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Javier Carazo

    (@carazo)

    You have some filters to do it:

    • cl_login_redirect_url
    • login_redirect

    Look at the controller class.

    Thread Starter originalpiratematerial

    (@originalpiratematerial)

    Thanks! Can you give an example of using that in practice?

    Plugin Author Javier Carazo

    (@carazo)

    add_filter( ‘cl_login_redirect_url’, function( $url ){
    // my logic

    return $url;
    } );

    Thread Starter originalpiratematerial

    (@originalpiratematerial)

    I can’t get this to work dynamically. Here is some test code. It always pulls through the post_name from the [clean-login] page. If I add a second clean-login page, it pulls through the most recent.

    add_filter( 'cl_login_redirect_url', function( $url ){
    global $post;
    $post_slug = $post->post_name;
    $url = '/' . $post_slug;
    return $url;
    } );
    Plugin Author Javier Carazo

    (@carazo)

    Sorry but this code has no logic.

    We cannot create a custom code for you from here. This is not the goal of the support.

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

The topic ‘Redirect shortcode options’ is closed to new replies.