• Resolved benbluef

    (@benbluef)


    Hi,

    I’m trying to use the phpBB redirect parameter to redirect the user to a WordPress page after logging into phpBB. For example: https://example.com/ucp.php?mode=login&redirect=../about-us/

    However, the w3all plugin is always redirecting to the home page. If I disable the plugin then it is possible to redirect to other pages.

    Is there a way to allow the phpBB redirect instead of always going to the home page?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author axew3

    (@axewww)

    Hello yes, it should had been fixed time ago.
    So It will be on next coming 2.6.6.

    But if you want in the while, on 2.6.5:

    Open file:
    /wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php

    lines
    585
    588
    591

    the code is this:

    if (empty($redirect_to)){
        wp_redirect(home_url()); exit();
      }
    
          wp_redirect( $redirect_to ); exit();
        }
    
     wp_redirect(home_url()); exit();

    JUST CHANGE INTO:

    if (empty($redirect_to)){
        //wp_redirect(home_url()); exit();
      }
    
          //wp_redirect( $redirect_to ); exit();
        }
    
     //wp_redirect(home_url()); exit();

    prepending with // so commenting/disabling the wp_redirect() that fire at this point of the flow.
    Save the modified file and load it in place of the default 2.6.5

    • This reply was modified 2 years, 2 months ago by axew3.
    • This reply was modified 2 years, 2 months ago by axew3.
    Thread Starter benbluef

    (@benbluef)

    I’ll give it a try, thanks!

    Plugin Author axew3

    (@axewww)

    psss
    may leave in place (do not deactivate commenting it with //) just the line
    wp_redirect( $redirect_to ); exit();

    and may change it into:
    wp_safe_redirect( $redirect_to ); exit();

    maybe do not comment out it, so that when an explicit redirect require to happen it will go as it need to be.
    If no more improvements added, because not useful, the 2.6.6 coming code will be like this, into last part of the verify_credentials function:

         $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
        if ( ( empty( $redirect_to ) || $redirect_to == admin_url() ) )
        {
          // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
          if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) )
            $redirect_to = user_admin_url();
          elseif ( is_multisite() )
            $redirect_to = get_dashboard_url( $user->ID );
          elseif ( is_admin() )
            $redirect_to = admin_url( 'profile.php' );
         // (try) check if it is a login done via phpBB into WP iframed page AND AVOID redirect to iframe if it is the first time login, so subsequent addition of the user in WP
         // or duplicate WP insertion in wp will happen!!
         // if it is a first time login, AVOID the redirect to page-forum (if in iframe mode and user regitered then login in phpBB iframed)
         if( !isset($on_ins) && isset($_SERVER['REQUEST_URI']) && !empty($wp_w3all_forum_folder_wp) && strstr($_SERVER['REQUEST_URI'], $wp_w3all_forum_folder_wp) )
         {
          $redirect_to = home_url() . '/' . $wp_w3all_forum_folder_wp; // this will cause duplicated user insert in wp, if phpBB login first time done in phpBB iframed
          wp_redirect( $redirect_to ); exit();
         }
    
         if( !empty($redirect_to) ){
          wp_redirect($redirect_to); exit();
         }
        }
        
        wp_safe_redirect($redirect_to); exit();
    
      }
    
        return;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘phpBB login redirect’ is closed to new replies.