Skip Navigation

[Resolved] Error adding new posts

This thread is resolved. Here is a description of the problem and solution.

Problem:
We get the error below when adding new posts:

Uncaught Error: Call to a member function get_value_filtered() on null in .../types/application/models/field/type/checkbox/view/frontend.php:33

Solution:

Head to Toolset > Custom Fields > and open all groups where you have saved a Field of Checkbox type.
Ensure, that none of these fields stores a 0 (numerical zero) as value.
If it does, replace with something allowed (0 is not allowed, as the GUI will tell you)

This should resolve that exceptional error.
If not, please report it to us.

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 replies, has 2 voices.

Last updated by Beda 4 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#1450557

I am trying to: add a new post

Link to a page where the issue can be seen: hidden link (WP access is needed)

I expected to see: post edition screen

Instead, I got: This error message; "Ha habido un error crítico en tu web. Por favor, revisa el buzón del correo electrónico de administración de tu sitio para instrucciones."

Aprende más sobre la depuración en WordPress.

#1450581

Please, can you enable WP Debug and let us know what the exact error is you see on the screen or logs after repeating the steps?
The email may also be of more information, which WordPress sends to you when such errors happen.

Here's how to enable debug information from WordPress
https://codex.wordpress.org/WP_DEBUG

#1450623

This is the content of the message sended by WP to admin account:

Desde WordPress 5.2 hay una característica incorporada que detecta cuándo un plugin o un tema causa un error fatal en tu sitio y te avisa mediante este correo electrónico automático.

En este caso, WordPress ha detectado un error con uno de tus plugins, Toolset Types.

Primero, visita tu web (hidden link) y comprueba si hay algún problema visible. A continuación, visita la página donde ha sido detectado el error (hidden link) y comprueba si hay algún problema visible.

Por favor, ponte en contacto con tu alojamiento para que te ayude a investigar más a fondo este problema.

Si tu sitio parece roto y no puedes acceder a tu escritorio con normalidad, ahora WordPress tiene un «modo de recuperación» especial. Este te permite acceder de forma segura a tu escritorio e investigar más a fondo.

hidden link

Para mantener tu sitio seguro, este enlace caducará en 1 día. Sin embargo, no te preocupes por esto: recibirás por correo electrónico un nuevo enlace si el error ocurre de nuevo después de que caduque.

Cuando busques ayuda para este problema, es posible que se te pida la siguiente información:
WordPress versión 5.3.2
Tema actual: Divi (versión 4.1)
Plugin actual: Toolset Types (versión 3.3.8)
PHP versión 7.3.13

Detalles del error
==================
Se ha producido un error del tipo E_ERROR en la línea 33 del archivo /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/models/field/type/checkbox/view/frontend.php. Mensaje de error: Uncaught Error: Call to a member function get_value_filtered() on null in /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/models/field/type/checkbox/view/frontend.php:33
Stack trace:
#0 /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/models/field/view.php(42): Types_Field_Type_Checkbox_View_Frontend->get_value()
#1 /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/models/field/service.php(137): Types_Field_View->render()
#2 /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/functions_public.php(58): Types_Field_Service->render_frontend(Object(Types_Field_Gateway_Wordpress_Post), Object(WP_Post), 'activar', Array, NULL)
#3 /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/types/application/functions_public.php(34): types_render_postmeta('activar', Array, NULL)
#4 /var/www/vhosts/laguijarrosa.es/httpdocs/wp-content/plugins/wp-views/vendor/toolset/dynamic-sources/server/ToolsetSources/Fiel

....

We have checked another site with types 3.3.7 version that has no errors. Furthermore, editing in wordpress recovery mode we can add posts withoout errors.

Please tell me if you need more information, and many thanks in advance for your attention. Cordial greetings.

#1452519

I can see at least one other report like yours:
https://toolset.com/forums/topic/view-cell-creation-not-working/#post-1414949

The reason you can not see this error on other sites is the same as I cannot see them:
We miss the steps to replicate it.

This is a very specific error related to the checkbox field type.
Do you use checkbox fields on your install with the error?

I also see the error is not complete, it terminates at step 4 but it seems it'd go further, to Views Plugin, but that seems truncated in your above post.
It seems related to where or how you display that single checkbox field with a ShortCode.

You say this happens with Types 3.3.8 only, and when adding new posts.
Hence I tested this locally, with a checkbox in the post admin screen this time, but I had no issues.

Can you either gather the precise steps how I can replicate this or if these aren't 100% clear, maybe can you send me a copy of the site along with a detailed description where and when/how the issue happens?

The problem is also, the other user mentioned above was doing something different, working with Layouts, it seems when they saw this error.
So I am totally sure it's replicable with several approaches, but I am not yet able to.

To fix the issue, it is crucial we can replicate it.
Looking at the code I can tell that a Toolset View must be involved too, but I am not sure how to see the error. It seems only to happen when you maybe have a View with a checkbox in it, or similar. Please let me know

I activated a private reply so you can submit me any of the above data privately if required.

#1455563

Dear Beda:

Effectively, applying the solution described in https://toolset.com/forums/topic/view-cell-creation-not-working/#post-1414949 resolve the issue.

For more information, I've replicate the issue, which is not specifically related with the Toolset Types 3.3.8 version, but occurs only with this version (perhaps with the following ones?)

- We work with WP in Spanish language but, after the execution of a Drupal contents importer plugin, which needs toolset types, add several custom fields to post type and set "Posts" (previously "Entradas") as plural name. If we edit and configure the plural name to be set "Entradas" again, then the issue is activated.

- Editing checkbox field as shown in the related report, or simply changing the name of "posts fields group", that is resetting Types setting cache, we have resolved the issue.

Many many thanks for your attention. Have a nice day.

#1455565

My issue is resolved now. Thank you again!

#1457459

I don't understand.

https://toolset.com/forums/topic/view-cell-creation-not-working/#post-1414949 is not a solution, it's an error.
It is the same error as you see and reported to us, here https://toolset.com/forums/topic/error-adding-new-posts-with-types-3-3-8/#post-1450623
It can hence not be a solution you applied now?

Can you elaborate?
Do you mean, you have a 0 saved as shown here?
https://toolset.com/forums/topic/view-cell-creation-not-working/#post-1422659

That value indeed can't be 0, so it'd be correct to update it if you have a 0 in there.
If that is all, then we did not miss anything 🙂

#1463567

Dear Beda:

I thought the solution was to edit and change a field in the group of custom check boxes to reset the Type configuration cache. In fact, simply changing any value of this group (such as the group name, for example) is enough for solving the error.
That's why I marked the issue as resolved.
My apologies for not having explained it better.
Have a nice day.

#1463569

My issue is resolved now (again) 😉 . Thank you!

#1463571

That is truly strange, as the issue is due to a zero value (0) in the checkbox field - which cannot be reset by simply re-saving the form with some "arbitrary" edits.
The edit that needs to be made is to remove the 0 and replace that with any valid value.

However, if you can confirm that you cannot replicate the issue anymore even if forcing it to - then you see the same as I do, which is that this is not replicable (anymore, at least) with the current Types, making it hence an obsolete, maybe bug in past.

I just want to be sure, that we are not "hiding" a bug just because there is a quick resolution to it - but as hard I try, I cannot make that error above happen with current types

#1463573

Closing as solved, in this case.