I’m looking for help adapting a Gravity Forms filter to select a value from a JetEngine CCT field.

[ad_1]

I have a staff contact form which fetches the email address from the post meta at the time of submission in order to prevent the staff member’s email from being exposed to the page (even as a hidden value). This is done with the filter/function show below.

This filter/function works fine when using an ACF or JetEngine Custom post. However, I would like to adapt it to work with a JetEngine Custom Content Type (CCT). The CCT item ID is being passed to the form as a query string “**?item\_id=99**”.

For those that don’t know, JetEngine CCT’s create a database table rather than storing in the Word Press posts. Essentially what I would need is to run a query (“SELECT name, email FROM jet\_cct\_staff WHERE \_ID = ‘$item\_id'”).

add_filter( ‘gform_notification_55’, ‘jetEmail’, 10, 3);
function jetEmail ($notification, $form, $entry){
$post_id = rgar($entry, ’14’);
GFCommon::log_debug( __METHOD__ . ‘(): Running for Form 55.’ );
GFCommon::log_debug( __METHOD__ . ‘(): The Entry => ‘ . print_r( $entry, true ) );
GFCommon::log_debug( __METHOD__ . ‘(): The Notification => ‘ . print_r( $notification, true ) );
if ($notification[‘name’] == “Web Contact”){
$notification[‘to’] = get_field(’email’, $post_id);
$notification[‘toType’] = ‘routing’;
$notification[‘routing’] = array(
‘fieldID’ => 1,
‘operator’ => ‘is’,
‘value’ => get_the_title($post_id),
’email’ => get_field(’email’, $post_id)
);
GFCommon::log_debug( __METHOD__ . ‘(): Email To => ‘ . print_r( $email_to, true ) );
GFCommon::log_debug( __METHOD__ . ‘(): Modified Notification => ‘ . print_r( $notification, true ) );
return $notification;
}
}

Thank you in advance.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer