Skip to content

Commit

Permalink
Merge pull request #4394 from buddyboss/PROD-7256
Browse files Browse the repository at this point in the history
PROD-7256
  • Loading branch information
KartikSuthar authored May 30, 2024
2 parents f45b1d8 + ac5669e commit 94b6b3d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
16 changes: 16 additions & 0 deletions src/bp-core/js/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ jQuery( document ).ready( function() {
jQuery( this ).find( 'input[type="number"]' ).before( html_error );
return_val = false;
}
if ( jQuery( this ).find( 'input[type="tel"]' ).length && jQuery( this ).find( 'input[type="tel"] ').val() == '' ) {
jQuery( this ).find( 'input[type="tel"]' ).before( html_error );
return_val = false;
}
if ( jQuery( this ).find( 'textarea' ).length && jQuery( this ).find( 'textarea' ).val() == '' ) {
jQuery( this ).find( 'textarea' ).before( html_error );
return_val = false;
Expand All @@ -259,6 +263,18 @@ jQuery( document ).ready( function() {
return_val = false;
}
}
if ( jQuery( this ).find( 'input[type="radio"]' ).length ) {
var checked_radio = 0;
jQuery( this ).find( 'input[type="radio"]' ).each( function () {
if ( jQuery( this ).prop( 'checked' ) == true ) {
checked_radio++;
}
} );
if ( 0 >= checked_radio ) {
jQuery( this ).find( 'legend' ).next().append( html_error );
return_val = false;
}
}
});
if ( jQuery( document ).find( signup_email ).length && jQuery( document ).find( signup_email ).val() == '' ) {
jQuery( document ).find( signup_email ).before( html_error );
Expand Down
15 changes: 10 additions & 5 deletions src/bp-templates/bp-nouveau/includes/xprofile/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ function bp_nouveau_xprofile_edit_visibilty() {
* @since BuddyPress 3.0.0
*/
function bp_nouveau_base_account_has_xprofile() {
return (bool) bp_has_profile(
array(
'profile_group_id' => bp_xprofile_base_group_id(),
'fetch_field_data' => false,
)
$fields = $_POST['signup_profile_field_ids'] ?? array();
$args = array(
'profile_group_id' => bp_xprofile_base_group_id(),
'fetch_field_data' => false,
);

if ( ! empty( $fields ) ) {
$args['include_fields'] = $fields;
}

return (bool) bp_has_profile( $args );
}
10 changes: 6 additions & 4 deletions src/bp-xprofile/bp-xprofile-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ function xprofile_filter_field_edit_name( $field_name ) {
* Conditionally filters 'bp_core_get_user_displayname' to return user display name from xprofile.
*
* @since BuddyBoss 1.2.3
* @since BuddyBoss 2.5.90 Added the `$current_user_id` parameter
* @since BuddyBoss 2.5.90 Added the `$current_user_id` parameter
*
* @global \BP_XProfile_Field_Type $field
*
Expand All @@ -810,7 +810,7 @@ function xprofile_filter_get_user_display_name( $full_name, $user_id, $current_u
global $bb_default_display_avatar;

$cache_key = 'bb_xprofile_filter_get_user_display_name_' . trim( $user_id ) . '_' . trim( $current_user_id );

if ( isset( $cache[ $cache_key ] ) && ! $bb_default_display_avatar ) {
return $cache[ $cache_key ];
}
Expand Down Expand Up @@ -1088,16 +1088,18 @@ function bp_xprofile_validate_social_networks_value( $retval, $field_id, $value,
$validation = array();
$field_name = xprofile_get_field( $field_id )->name;

$providers = bp_xprofile_social_network_provider();

if ( 1 === $field->is_required ) {
foreach ( $value as $key => $val ) {
$val = trim( $val );
if ( empty( $val ) ) {
$validation[ $key ] = sprintf( __( '%s is required and not allowed to be empty.', 'buddyboss' ), $field_name );
$key = bp_social_network_search_key( $key, $providers );
$validation[ $key ] = sprintf( __( '%s is required and not allowed to be empty.', 'buddyboss' ), $providers[ $key ]->name );
}
}
}

$providers = bp_xprofile_social_network_provider();
foreach ( $value as $k => $v ) {
if ( ! empty( $validation ) && ! empty( $validation[ $k ] ) ) {
continue;
Expand Down

0 comments on commit 94b6b3d

Please sign in to comment.