Changeset 12203 for sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/search.php
- Timestamp:
- 11/04/2022 08:48:57 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/search.php
r11679 r12203 29 29 public static function is_search( $query ) { 30 30 return ! is_admin() && $query->is_search() && $query->is_main_query(); 31 } 32 33 /** 34 * Determines if the search query matches the username of a contributor. 35 * 36 * The search must be solely for the user's nicename and a found user must 37 * also have a published photo. 38 * 39 * @param string $search The search string. 40 * @return WP_User|false The user if the search matches a contributor, else false. 41 */ 42 public static function query_matches_username( $search ) { 43 $matches = false; 44 45 if ( preg_match( '/^[a-zA-Z0-9_]{3,}$/', $search ) ) { 46 $user = get_user_by( 'slug', $search ); 47 if ( $user && User::count_published_photos( $user->ID ) ) { 48 $matches = $user; 49 } 50 } 51 52 return $matches; 31 53 } 32 54
Note: See TracChangeset
for help on using the changeset viewer.