You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a snippet i wrote to retrieve gf submissions by the logged in user (subscriber role).
function my_graphql_gf_entries_connection_query_args($query_args, $resolver)
{
// Check if the current user is not an administrator.
if (! current_user_can('administrator')) {
$current_user_id = get_current_user_id();
// Initialize fieldFilters if not set.
if (! isset($query_args['fieldFilters']) || ! is_array($query_args['fieldFilters'])) {
$query_args['fieldFilters'] = [];
}
// Append the filter to only include entries created by the current user.
$query_args['fieldFilters'][] = [
'key' => 'created_by',
'intValues' => [$current_user_id],
'operator' => 'IN',
];
}
return $query_args;
}
add_filter('graphql_gf_entries_connection_query_args', 'my_graphql_gf_entries_connection_query_args', 10, 2);
It looks like the filter is not getting applied and I am not sure what seems wrong here.
Any help or insights will be greatly appreciated. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Below is a snippet i wrote to retrieve gf submissions by the logged in user (subscriber role).
It looks like the filter is not getting applied and I am not sure what seems wrong here.
Any help or insights will be greatly appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions