Saltar navegación

[Resuelto] Add filter to cred form

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

Add multiple form IDs to custom codes.

Solution:

You can use PHP function in_array() to check more form ID as an array, for example:

https://toolset.com/forums/topic/add-filter-to-cred-form/#post-1131547

Relevant Documentation:

http://php.net/in_array

This support ticket is created hace 6 años, 4 meses. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Etiquetado: 

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Luo Yang hace 6 años, 4 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1130668

Hi,

I've t used the the followuin code to add a filter as you sagget me in a previeus ticket.

The code is:

if($cart_item['cred_meta']['cred_form_id'] != 24662 || !isset($cart_item['cred_meta']['cred_post_id']) ) || return $name;
....

I've to add the same filter to another form. How I've to change the code? I tryed wuth this, but is does not works

if($cart_item['cred_meta']['cred_form_id'] != 24662 || $cart_item['cred_meta']['cred_form_id'] != 25474 || !isset($cart_item['cred_meta']['cred_post_id']) ) || return $name;
....
#1131547

Hi,

You can use PHP function in_array() to check more form ID as an array, for example:

if( in_array($cart_item['cred_meta']['cred_form_id'], array(24662, 25474))
|| !isset($cart_item['cred_meta']['cred_post_id']) ) || return $name;

More help:
enlace oculto
Checks if a value exists in an array

#1132277

My issue is resolved now. Thank you!

#1132451

You are welcome