Buddypress-Validate required registration field – but not with bp-profile-setup
-
(i assume it can be done as captchas do it!)
Have added a field to the registration form like this : (—-> my problem is to validate this field)
1) added these functions to functions.php
/* Add sign-up field to BuddyPress sign-up array */
`function anewbp_custom_user_signup_field( $usermeta ) {
$usermeta = $_POST;
return $usermeta;
}
add_filter( ‘bp_signup_usermeta’, ‘anewbp_custom_user_signup_field’ );`/* Add field_name from sign-up to usermeta on activation */
`function anewbp_user_activate_field( $signup ) {update_usermeta( $signup, ‘eyecolor’, $signup );
return $signup;
}
add_filter( ‘bp_core_activate_account’, ‘anewbp_user_activate_field’ );`2) have added this to register.php at an appropriate place
`
`So far so good.
However I need this to be a REQUIRED field and am having problems !!
What have I tried ?
a)
`function anewbp_check_validation(){
global $bp;
$anewbp_custom_user_signup_field_txt = $_POST;if (empty($anewbp_custom_user_signup_field_txt) || $anewbp_custom_user_signup_field_txt == ”) {
$bp->signup->errors = __(‘Please complete this field’,’buddypress’);
}
return;
}
add_action(‘bp_signup_validate’, ‘ anewbp_check_validation’);`AND
` ` in register.php
b)
`function anewbp_check_validation(){
global $bp;
if (empty($_POST) || $_POST == ”) {
$bp->signup->errors = __(‘Please complete this field’,’buddypress’);
return;
}
}
add_action(‘bp_signup_validate’, ‘anewbp_check_validation’);`AND
` ` in register.php
and other variations. –> none have worked
Where I’m coming from? —> Can follow and would be grateful for detailed instructions
mainly a copy and paster but gradually getting an understanding of php.
- The topic ‘Buddypress-Validate required registration field – but not with bp-profile-setup’ is closed to new replies.