*' : '' );
if ( array_key_exists( $field['id'], $field_check_errors ) )
$error_mark = '';
$extra_attr = apply_filters( 'wppb_extra_attribute', '', $field, $form_location );
$output = '
';
if( !empty( $item_description ) )
$output .= ''. $item_description .'';
}
return apply_filters( 'wppb_'.$form_location.'_firstname', $output, $form_location, $field, $user_id, $field_check_errors, $request_data );
}
add_filter( 'wppb_output_form_field_default-first-name', 'wppb_first_name_handler', 10, 6 );
/* handle field validation */
function wppb_check_first_name_value( $message, $field, $request_data, $form_location ){
if( $field['required'] == 'Yes' ){
if( ( isset( $request_data['first_name'] ) && ( trim( $request_data['first_name'] ) == '' ) ) || !isset( $request_data['first_name'] ) ){
return wppb_required_field_error($field["field-title"]);
}
}
return $message;
}
add_filter( 'wppb_check_form_field_default-first-name', 'wppb_check_first_name_value', 10, 4 );
/* handle field save */
function wppb_userdata_add_first_name( $userdata, $global_request ){
if ( isset( $global_request['first_name'] ) )
$userdata['first_name'] = sanitize_text_field( trim( $global_request['first_name'] ) );
return $userdata;
}
add_filter( 'wppb_build_userdata', 'wppb_userdata_add_first_name', 10, 2 );