Skip to:
Content
Pages
Categories
Search
Top
Bottom

Looking for hook before bp_signup_validate


  • terraling
    Participant

    @terraling

    I’m tweaking the sign-up with some custom validation.

    I’m looking through bp_core_screen_signup() in bp-members-screens.php which runs through a battery of tests and then offers the hook bp_signup_validate to perform additional tests, but I need to do something BEFORE it runs through those tests not after.

    What can I hook into?

    (If you want to know why, I’m trying to make sign-up on mobile as frictionless as possible by not requiring the user to enter their password twice. On my custom registration form I make the input #signup_password_confirm hidden and with javascript just copy over what is entered in #signup_password. But to allow for javascript being disabled I need to repeat if necessary on the server before handing off to the tests in bp_core_screen_signup.)

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

  • Henry Wright
    Moderator

    @henrywright

    @terraling

    How about tricking BP into thinking the password has been entered twice? You can do that with a little JavaScript. You’d need to make the 2nd password field into a hidden input so that the value is still submitted with the form.

    Here is the general idea:

    <input type="password" name="signup_password" id="signup_password" class="input" value="" />
    <input type="hidden" name="signup_password_confirm" id="signup_password_confirm" value="" />

    JS:

    <script>
        $('#signup_password').keyup(function () {
            $('#signup_password_confirm').val(this.value);
        });
    </script>

    terraling
    Participant

    @terraling

    Thanks @henrywright but you must not have read my question.

    I already did that, but need something server side in case javascript is unavailable on the client.


    Henry Wright
    Moderator

    @henrywright

    Oops I do apologise! I read up to “What can I hook into?” and couldn’t think of a hook then got carried away thinking of how you could solve the problem 🙂

    EDIT: Perhaps you could request a new hook?

    https://buddypress.trac.wordpress.org/


    terraling
    Participant

    @terraling

    I figured out I could intercept it earlier.

    bp_core_screen_signup is loaded in the action bp_screens with a default priority of 10, so I added


    add_action( 'bp_screens', 'bp_core_screen_signup_tweak', 9 );
    function bp_core_screen_signup_tweak() {
    if ( isset( $_POST['signup_password'] ) ) {
    $_POST['signup_password_confirm'] = $_POST['signup_password'];
    }
    }


    Devilish
    Participant

    @devilish

    I managed to kill my site by plugin bp redirect to profile. any idea how i can fix this? i am the mentor of over 3000 teens and they wont be able to log in. i need help


    Henry Wright
    Moderator

    @henrywright

    @terraling nice solution! Using that approach, I don’t think you will need any JavaScript at all now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Looking for hook before bp_signup_validate’ is closed to new replies.
Skip to toolbar