Skip to:
Content

BuddyPress.org

Opened 4 months ago

Last modified 4 months ago

#8277 new defect (bug)

iSSUE with BUDDYPRESS LOGIN WIDGET

Reported by: giuseppecuttone Owned by:
Milestone: Awaiting Review Priority: high
Severity: normal Version: 5.0.0
Component: Core Keywords: reporter-feedback
Cc:

Description

Hi,
if I add in http://www.mysite.com/wp-login.php? some checkboxes about TERMS OF USE, PRIVACY etc... the checkboxes I add will be showed well in http://www.mysite.com/wp-login.php? but checkboxes will not be showed in the BUDDYPRESS LOGIN WIDGET.

Code I am using is the follow:
(as you can see I am using hook provided by wordpress)
https://codex.wordpress.org/Customizing_the_Login_Form

<?php
// As part of WP authentication process, call our function
add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2);

function wp_authenticate_user_acc($user, $password) {
    // See if the checkbox #login_accept was checked
    if ( isset( $_REQUEST['login_accept'] ) && $_REQUEST['login_accept'] == 'on' ) {
        // Checkbox on, allow login
        return $user;
    } else {
        // Did NOT check the box, do not allow login
        $error = new WP_Error();
        $error->add('did_not_accept', 'You must accept the terms and conditions' );
        return $error;
    }
}

// As part of WP login form construction, call our function
add_filter ( 'login_form', 'login_form_acc' );

function login_form_acc(){
    // Add an element to the login form, which must be checked
    echo '<label><input type="checkbox" name="login_accept" id="login_accept" /> I agree</label>';

Can someone make the correspondent modification to BuddyPress code to have running also my code into BuddyPress LogIn widget?

Thanks very very very very very very for your support.

Change History (1)

#1 @imath
4 months ago

  • Keywords reporter-feedback added

Hi,

Thanks a lot for submitting this ticket. I believe it's probably best you use the hook we provide to include the extra fields into the BP login form.

You simply need to add this line of code:

add_action( 'bp_login_widget_form', 'login_form_acc' );

Is this ok for you ?

Note: See TracTickets for help on using tickets.