How to exclude Mail-Adresses from Directory Search?
-
Hello, is there currently a way to exclude Mail-Addresses from the member directory search?
I tried the following plugin, which should exclude them by default, but it seems not to work (anymore?), because I can still find users with their Mail in my member directory:
https://github.com/MissVeronica/um-reduced-member-directory-search
The plugin does not seem to have an effect.
Then I tried to use the filter from the documentation. I added it to my function.php:
function um_061522_pre_users_query( $obj, $directory_data, $sortby ){ if( $obj->is_search == true && ! empty( $_POST['search'] ) ){ if( ! empty( $obj->where_clauses ) ){ foreach( $obj->where_clauses as $k => $w ){ if( strpos( $w, 'umm_search' ) > -1 ){ $w = explode(" OR ", $w ); $obj->where_clauses[ $k ] = str_replace("( umm_search.um_value = ", "( umm_search.um_key = 'display_name' AND umm_search.um_value LIKE ", $w[0] . '%' ) . ')'; } } } } } add_action("um_pre_users_query","um_061522_pre_users_query", 10, 3 );
If I understand it right, with my code it should just search only in the username. But with the code I always get 0 results…
Any idea?
- The topic ‘How to exclude Mail-Adresses from Directory Search?’ is closed to new replies.