I blame my lazy fingers for the transposition in notification.
After some minor modifications – and fixing typos, I got this working using my second example above:
add_filter( 'gform_notification_55', 'acf_email', 10, 3);
function acf_email ($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('staff_email', $post_id);
$notification['toType'] = 'routing';
$notification['routing'] = array(
'fieldID' => 1,
'operator' => 'is',
'value' => get_field('full_name', $post_id),
'email' => get_field('staff_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;
}
}
My question is where does this go, and how would I get the sort to carry over to an Elementor archive?
I have a staff directory page which I would like to sort by department and position (manager, supervisor, staff). So My array would look like below, but I don’t know where to save it or implement it.
Also, I’m not sure if it would be better to set up my department and position fields as text or use a numeric id. If I was doing this in a database I would select the ID and output the label.
$posts = get_posts( array(
'numberposts' => -1,
'post_type' => 'Staff-Member',
'meta_query' => array(
'relation' => 'AND',
'department' => array(
'key' => 'department',
'value' => array(1,2,3),
// 1='Admin', 2='Fiscal', 3='Maintenance'
),
'position' => array(
'key' => 'position',
'value' => array(1,2,3)
// 1='Manager', 2='Supervisor', 3='Staff'
)
),
'orderby' => array(
'department' => "ASC",
'position' => "ASC",
),
) );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.