wpcasa
wpcasa copied to clipboard
Report after testing Ninja Forms with PHP 8.2
Prerequisites
- [ ] This issue is neither a bug report nor a feature request.
- [x] I've experience in webdevelopment
- [ ] I'm new to WordPress
Description
Addon Ninja Forms should be updated, but the repo is not, so I am writing this here. I have got 2 issues with latest version.
- not able to select the agent email field in admin area
Original code:
if( '_hidden' == $field->get_type() )
$form_fields[ $form_field_id ] = $field['data']['label'];
this didn't work, I had to change it to:
if( 'hidden' == $field->get_setting('type') )
$form_fields[ $form_field_id ] = $field->get_setting('label');
- fatal error on frontend (or warning, I am not sure now) $ninja_forms_loading was NULL Original code:
global $ninja_forms_loading;
if( $_form_id && $_field_id && $_form_id == $form_id )
$ninja_forms_loading->update_field_value( $_field_id, antispambot( get_the_author_meta( 'email' ) ) );
Working code (not sure if it is the right fix)
$ninja_forms_loading = Ninja_Forms()->form($form_id);
if( $_form_id && $_field_id && $_form_id == $form_id ) {
$field = $ninja_forms_loading->get_field($_field_id);
$field->update_setting('default', antispambot(get_the_author_meta('email')));
}
Used position: After the end
Thanks