WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
register_redirect() doesn't honor redirects made by other plugins (3 posts)

  1. garnser
    Member
    Posted 3 years ago #

    Hi all,

    I've been working a bit on getting Theme my login and Register Plus Redux working together. After experiencing some odd behaviors in the redirects post-registration I noticed that this function:

    function register_redirect( $redirect_to ) {
    // Redirect to login page with "registration=complete" added to the query
    $redirect_to = site_url( 'wp-login.php?registration=complete' );
    // Add instance to the query if specified
    if ( isset( $_REQUEST['instance'] ) & !empty( $_REQUEST['instance'] ) )
    $redirect_to = add_query_arg( 'instance', $_REQUEST['instance'], $redirect_to );
    return $redirect_to;
    }

    Since $redirect_to is defined within the function it overrules any other redirects. The following patch ensures the redirect is honored, please submit it upstreams.

    *** a/custom-passwords.php 2011-03-10 08:28:54.000000000 +0100
    --- b/custom-passwords.php 2011-03-10 08:29:18.000000000 +0100
    ***************
    *** 340,346 ****
    */
    function register_redirect( $redirect_to ) {
    // Redirect to login page with "registration=complete" added to the query
    ! $redirect_to = site_url( 'wp-login.php?registration=complete' );
    // Add instance to the query if specified
    if ( isset( $_REQUEST['instance'] ) & !empty( $_REQUEST['instance'] ) )
    $redirect_to = add_query_arg( 'instance', $_REQUEST['instance'], $redirect_to );
    --- 340,346 ----
    */
    function register_redirect( $redirect_to ) {
    // Redirect to login page with "registration=complete" added to the query
    ! if ( empty( $redirect_to ) ) $redirect_to = site_url( 'wp-login.php?registration=complete' );
    // Add instance to the query if specified
    if ( isset( $_REQUEST['instance'] ) & !empty( $_REQUEST['instance'] ) )
    $redirect_to = add_query_arg( 'instance', $_REQUEST['instance'], $redirect_to );

  2. Jeff Farthing
    Member
    Plugin Author

    Posted 3 years ago #

    Not needed. If you need a redirect to overrule that one, just add a higher priority to the filter callback.

  3. garnser
    Member
    Posted 3 years ago #

    Fair enough, however it seams weird that the function would take an argument to begin with if it's overwritten immediately.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic