Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbp_wp_login_action question

  • I have a page (/register) that is using [bbp-register].

    The only issue I’m having is after the user registers they get redirected back to the same back and see the registration form again, so they are getting confused and often wondering if the registration went through at all (it does).

    bbp_wp_login_action appears to be filterable, but I haven’t had any luck getting it to accept a URL to redirect to (redirect_to) after the registration goes through?

    Maybe I’m not passing something right? :P

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

  • Stephanie Leary
    Participant

    @sillybean

    This is confusing the heck out of my users as well. My forum is set up on a WP network subsite. They register there (the form is generated by the shortcode), and on completion they’re redirected to the main network site’s registration page — which looks completely different.

    The UX is very broken. :(


    Stephanie Leary
    Participant

    @sillybean

    OK, changeset #3450 only partially fixes this problem. Even with a ‘bbp_user_register_redirect_to’ filter, the redirect_to hidden field still gets stomped by the first if() in bbp_redirect_to_field() — line 741.

    I tested this on my multisite install. With that first if() commented out, the redirect_to field is set correctly — but even so, I get redirected to the main site’s wp-signup.php.

    ETA: OH! I think we’re seeing two different problems here.

    On Jared’s single-site install, I suspect what’s happening is that the page containing the registration shortcode just isn’t doing anything with the checkemail query arg. So, it would be fine to have the user redirected back to that page, as long as the query arg generated the proper “check your email” notice.

    What I’m seeing on multisite actually looks like this bug in WP itself.


    Stephanie Leary
    Participant

    @sillybean

    … I should probably post my filter mini-plugin in case anyone else is testing this:

    <?php
    /*
    Plugin Name: bbPress Registration Redirect
    Plugin URI: http://sillybean.net/
    Version: 0.2
    Author: Stephanie Leary
    */

    add_filter( 'bbp_user_register_redirect_to', 'scl_print_bbp_redirect' );
    function scl_print_bbp_redirect($url) {
    return 'http://forum.sillybean.net/register/confirm/';
    }
    ?>

    Hey folks,

    I was struggling with this for a while, and I think I found a bug in bbp-common-template.php

    Here’s the original, plus an echo I put in to dump the value. It returned the blog url no matter what else I did with filters beforehand:

    function bbp_redirect_to_field( $redirect_to = ” ) {

    // Rejig the $redirect_to

    if ( !isset( $_SERVER ) || ( !$redirect_to = home_url($_SERVER ) ) )

    $redirect_to = wp_get_referer();

    echo $redirect_to;

    exit;

    Should this be an OR statement? (||) I found that changing it so and (&&) seems to make it function as intended.

    Also, is this supposed to be an assignment here (!$redirect_to=), or should it be a comparison (==). Changing that that to !$redirect_to== ALSO made it function as intended. One way or another, this line is the culprit.


    gloomis120
    Member

    @gloomis120

    Wow, great work. mesayre’s code edit with using && instead of || fixed an issue for me with after login, getting redirected back to the home url and not the forum url.

    Thanks for this. Obviously the = assignment is the culprit, I changed that and it now works for me. Changing || to && does fix it but might break something else, I’m not sure what the logic is but definitely the single = is wrong.

    Andeeh,

    Thanks for following up on this. I tagged it a while back hoping a dev might see it, but I’m not sure they noticed. I’m having trouble finding instructions for submitting a patch, otherwise I’d do it myself.

    Can any devs confirm this issue?

    Thanks!

    I’ve now submitted this on trac. Here’s the ticket:

    http://bbpress.trac.wordpress.org/ticket/1709


    jamieskella
    Member

    @jamieskella

    This bug is still apparent in 2.1 – is there any reason for this?

    Edit: actually it has been fixed with ==


    mesayre
    Member

    @mesayre

    Super! Thanks!


    gabrielstuff
    Participant

    @gabrielstuff

    Hey there, please find my little code that I’ve put into function.php :

    function ela_signup_redirect($redirect_to){
      $return_url = "";
    
    if (defined('ICL_LANGUAGE_CODE')) {
        switch (ICL_LANGUAGE_CODE) {
            case 'fr':
                $return_url = "http://xxx/merci/";
              break;
            case 'en':
                  $return_url = "http://xxx/forum/sinscrire/";
              break;
            default:
                  $return_url = 'langue non configurée';
              break;
        }
    }
    error_log("message : " . $return_url);
    return $return_url;
    }
    add_filter("bbp_user_register_redirect_to", "ela_signup_redirect");
    

    I’ve been trying to debug everywhere and hunt when the redirect happen, but I still get redirected to the admin panel.

    Any help would be appreciated.


    gabrielstuff
    Participant

    @gabrielstuff

    Fixed !

    The core wordpress was doing some security check that break the redirect ! it works perfectly.

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

You must be logged in to reply to this topic.