Opened 6 years ago
Closed 5 years ago
#8277 closed defect (bug) (worksforme)
iSSUE with BUDDYPRESS LOGIN WIDGET
| Reported by: | giuseppecuttone | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Core | Version: | 5.0.0 |
| Severity: | normal | 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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:
Is this ok for you ?