[Resolved] Add filter to cred form

Hi, Amit here, I am the Toolset Support Manager, our current ticket queue is calm and I'd like to encourage you to use our new chat support option

In order to try it out please notice that when you open a ticket (while there's availability) you will be able to choose between chat and a normal ticket, both lanes lead to the same supporters and if we decide in chat that the issue needs more time we'll transform it into a normal email ticket for you, so nothing is lost

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.

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

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

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 3 months, 3 weeks ago.

Assigned support staff: Luo Yang.

Author
Posts
#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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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:
hidden link
Checks if a value exists in an array

#1132277

My issue is resolved now. Thank you!

#1132451

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

You are welcome