Sorry I’m trying without exit
I have the form no 27 and a Advanced Field name
I insert the following code in the visual-form-builder-pro.php
function vfb_filter_field_default( $default, $field_type, $field_id, $form_id ){
$first = $last = '';
switch ( $field_type ) :
case 'name' :
if ( 114 == $form_id && is_user_logged_in() ) :
$current_user = wp_get_current_user();
if ( !empty( $current_user->user_firstname ) && empty( $current_user->user_lastname ) )
$first = $current_user->user_firstname;
else if ( empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) )
$last = $current_user->user_lastname;
else if ( !empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) ) {
$first = $current_user->user_firstname;
$last = $current_user->user_lastname;
return "$first $last";
endif;
break;
case 'email' :
if ( 114 == $form_id && is_user_logged_in() ) :
$current_user = wp_get_current_user();
if ( !empty( $current_user->user_email ) )
$default = $current_user->user_email;
return $default;
endif;
break;
endswitch;
return $default;
}
and then I call the filter from the form-output.php
add_filter( 'vfb_field_default', 'vfb_filter_field_default', 10, 4 );
And when I try to actívate the pluging I received the following error
Parse error: syntax error, unexpected T_ENDIF in C:\Llocs Web\onomricat\www\wp-content\plugins\visual-form-builder-pro\visual-form-builder-pro.php on line 4127