Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ed_format_champs_wpfusion( $user_meta, $user_id ) {
- // Define fields that need uppercase formatting
- $uppercase_fields = array(
- 'ACF_nom',
- 'ACF_derniere_entreprise',
- 'ACF_derniere_fonction',
- 'ACF_nouvelle_entreprise',
- 'ACF_nouvelle_fonction',
- 'ACF_cabinet'
- );
- // Process each field in the user meta
- foreach ( $user_meta as $field_key => $field_value ) {
- // Check if this field needs uppercase formatting
- if ( in_array( $field_key, $uppercase_fields ) ) {
- // Apply uppercase and trim to text values
- if ( is_string( $field_value ) ) {
- $user_meta[ $field_key ] = mb_strtoupper( trim( $field_value ) );
- }
- }
- // Handle phone number field - remove spaces
- elseif ( $field_key === 'ACF_telephone_mobile' ) {
- if ( is_string( $field_value ) ) {
- $user_meta[ $field_key ] = str_replace( ' ', '', $field_value );
- }
- }
- }
- return $user_meta;
- }
- add_filter( 'wpf_user_register', 'ed_format_champs_wpfusion', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment