Last active
October 22, 2018 20:09
-
-
Save cliffordp/7d5e3bbe9751a3c391c0e4ff6c93db4f to your computer and use it in GitHub Desktop.
Get a count of Gravity Forms entries in October 2018 that are not trashed that were not created by an Administrator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$admin_users = get_users( [ 'role' => 'administrator' ] ); | |
$admin_user_ids = wp_list_pluck( $admin_users, 'ID' ); | |
$entries_search = [ | |
'status' => 'active', // non-trashed entries | |
'start_date' => '2018-10-01 00:00:00', // October 1 | |
'end_date' => '2018-10-31 23:59:59', // October 31 | |
'field_filters' => [ | |
[ | |
'key' => 5, // Field ID 5 | |
'value' => 277, // Entry value | |
'operator' => '=', | |
], | |
// entry not created by an Administrator | |
[ | |
'key' => 'created_by', | |
'value' => $admin_user_ids, | |
'operator' => 'NOT IN', | |
], | |
], | |
]; | |
$used = GFAPI::count_entries( 3, $entries_search ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment