gpb_customer_name
Description
Filter the resolved customer name for a booking.
Usage
Applied globally
add_filter( 'gpb_customer_name', 'my_custom_function' );Parameters
$name
string
The resolved customer name.
$entry
array|WP_Error
The Gravity Forms entry array or WP_Error when entry lookup fails.
$booking
Booking
The booking instance.
Examples
Display customer names as initials.
add_filter( 'gpb_customer_name', function ( $name ) {
$parts = preg_split( '/s+/', trim( $name ) );
if ( empty( $parts ) ) {
return $name;
}
$initials = array_map( function ( $part ) {
return strtoupper( substr( $part, 0, 1 ) );
}, $parts );
return implode( '', $initials );
} );