1

In wordpress, when setting up a ninja form text block I get the following error. It shows up next to the "Add Media" button so I assume that it is trying to add a Civicrm button and fails.

Notice: Trying to get property of non-object in /var/www/wordpress/wp-content/plugins/civicrm/includes/civicrm.shortcodes.modal.php on line 170 Call Stack: 0.0000 239040 1. {main}() /var/www/wordpress/wp-admin/admin-ajax.php:0 0.1404 4172272 2. do_action() /var/www/wordpress/wp-admin/admin-ajax.php:89 0.1404 4173800 3. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:503 0.1404 4173944 4. ninja_forms_new_field() /var/www/wordpress/wp-includes/plugin.php:503 0.1940 4190192 5. ninja_forms_return_echo() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/admin/ajax.php:193 0.1940 4207304 6. call_user_func_array() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/functions.php:7 0.1940 4207768 7. ninja_forms_edit_field() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/functions.php:7 0.1941 4207952 8. do_action() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/admin/edit-field/edit-field.php:6 0.1941 4209592 9. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:503 0.1941 4209760 10. ninja_forms_edit_field_output_li() /var/www/wordpress/wp-includes/plugin.php:503 0.1958 4214568 11. nf_output_registered_field_settings() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/admin/edit-field/li.php:123 0.1987 4218784 12. ninja_forms_edit_field_el_output() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/admin/edit-field/li.php:419 0.1993 4221088 13. wp_editor() /var/www/wordpress/wp-content/plugins/ninja-forms/includes/admin/edit-field/edit-field.php:132 0.1995 4230840 14. _WP_Editors::editor() /var/www/wordpress/wp-includes/general-template.php:2565 0.2024 4238472 15. do_action() /var/www/wordpress/wp-includes/class-wp-editor.php:222 0.2096 4250120 16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:503 0.2096 4250272 17. CiviCRM_For_WordPress_Shortcodes_Modal->add_form_button() /var/www/wordpress/wp-includes/plugin.php:503 0.2096 4250344 18. CiviCRM_For_WordPress_Shortcodes_Modal->post_type_has_button() /var/www/wordpress/wp-content/plugins/civicrm/includes/civicrm.shortcodes.modal.php:101

It prevents the text field from being saved in the form. In this case I don't need any civicrm processing in the form so it does not need to be there but I don't know how to remove it. Has anyone dealt with this before?

Versions: Wordpress 4.3.1, Civicrm 4.6.8, Ninja forms 2.9.28

  • Can you add the versions of WordPress, CiviCRM and Ninja Forms? – Kevin Cristiano Oct 4 '15 at 13:29
  • Interesting. So it's the wp_editor() function that's triggering the error on an admin screen that has no post type set. – Christian Wach Oct 5 '15 at 15:39
1

Fixing this will require a change to the Civi-WP plugin. In the meantime, put the following code on a new line below the one that reads $screen = get_current_screen(); which should be at line 164 of 'civicrm.shortcodes.modal.php'.

if ( ! isset( $screen->post_type ) ) return;

That should mean your fields are saved again.

  • Perfect. Thank you! – user260078 Oct 6 '15 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.