This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook allows you to remove the current user filter from a Lookup field.
Usage
add_filter( 'frm_lookup_is_current_user_filter_needed', 'frm_current_user_filter_lookup', 20, 3 );
Parameters
- $use_filter (boolean): determines whether or not current user filter should be used
- $field_id (int|string): the ID of the Lookup field
- $field_options (array): the Lookup field's options
Examples
Basic example
Remove the current user filter from a Lookup field for a specific user role. Replace 23 with your field ID and replace "administrator" with the user role that you would like to remove the filter for.
add_filter( 'frm_lookup_is_current_user_filter_needed', 'frm_lookup_remove_current_user_filter', 20, 3 );
function frm_lookup_remove_current_user_filter( $use_filter, $field_id, $field_options ) {
if ( $field_id == 23 && current_user_can( 'administrator' ) ) {
$use_filter = false;
}
return $use_filter;
}