How to show TERMS AND CONTIDIONS checkboxes in BuddyPress LogIn widget
-
Hi,
if I add in http://www.mysite.com/wp-login.php? some checkboxes about TERMS OF USE, PRIVACY, I AGREE SENT COMERCIAL INFORMATION, and any other checkbox needed to acomplish with DATA PROTECTION LEGISLATION, the checkboxes I add will be showed well in http://www.mysite.com/wp-login.php? but they will not be showed in the BUDDYPRESS LOGIN WIDGET.
Code I am using is the follow:<?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 this code to have this feature running also into BuddyPress LogIn widget?
Thanks very very very very very very for your support.
-
@giuseppecuttone for signup page you will have to use
bp_signup_validate
bp_before_registration_submit_buttonsYou can try this, seems still working
Hi @vapvarun first thanks for your reply.
Plugin you suggest is able to add terms and conditions checkbox to the registration page (SIGNUP), but is not able to add terms and conditions checkbox neither to http://www.mysite.com/wp-login.php? (SIGNIN) nor to BUDDYPRESS LOGIN WIDGET.
Has you know signup is different than signin… I am sure you have read my post fastly and you dont detected this “litlle / big” difference…
Waiting reply of @imath if you have something more to add you are welcome π
Thanks for your support.I think BuddyPress just uses the standard WP login page so https://codex.wordpress.org/Customizing_the_Login_Form has info on customising or even replacing the page.
On one of my sites I created a completely new page following this guide, https://themetrust.com/build-custom-wordpress-login-page/
It should be simple enough to create a custom page that disables the login button unless the checkbox is selected.First, @iamthewebb thanks for your reply.
I dont understand why you do this afirmation:
“It should be simple enough to create a custom page that disables the login button unless the checkbox is selected.”
I have done it thanks the code I pasted in my first message.
Whit this code now to my login page (http://www.mysite.com/wp-login.php? ) is showed a checkbox I can use for TERMS OF USE of my web.
This is ok.
The “why” I have opened this thread is because this checkboxes is not showed in the BUDDYPRESS LOGIN WIDGET when I create a custom login page using BUDDYPRESS LOGIN WIDGET.
So this “error” should be an error of BuddyPress who should to do a hook (in BUDDYPRESS LOGIN WIDGET) to get checkboxes (and others actions) from http://www.mysite.com/wp-login.php?This is why I asked to @imath to introduce it in the V6 release of buddypress.
Waiting for reply. π
Sorry I’ve just read about this issue. Having it fixed in 6.0.0 seems difficult as there’s no ticket about it in Trac and the release is scheduled to the end of this month. If it’s just adding a hook available in the /wp-login.php page then, why not but if Plugins adding these checkboxes are using different hooks it can be challenging.
Could you open a ticket on Trac ( https://buddypress.trac.wordpress.org/newticket ) and eventually find out what is the name of the WP hook these plugins are using to try to have it fixed asap ?
Thanks in advance for your help.
Hi @imath first thanks for your reply.
As you can see from my code I have added to my first message, I am using an hook provided by WORDPRESS
https://codex.wordpress.org/Customizing_the_Login_FormSo correction of buddypress code should be simple and efective…
I have opened a new ticket in TRAC
https://buddypress.trac.wordpress.org/ticket/8277#ticketI hope this issue can be resolved before release V6
As you say: “If itβs just adding a hook available in the /wp-login.php page then, why not”
π
- You must be logged in to reply to this topic.