From 73d99a17c9cc11202acb158ed4af31379a4846c5 Mon Sep 17 00:00:00 2001 From: saurab018 Date: Wed, 12 Aug 2026 13:49:30 +0545 Subject: [PATCH] Support member search by full name (UR-4815) Member search only matched first_name/last_name/nickname individually, so a full-name query (e.g. "John Smith") failed whenever the name was stored as separate first/last usermeta rather than combined into a single field like display_name. Add a concatenated first_name + last_name match (both orders) alongside the existing per-field checks in urm_search_user_on_name(), so full-name search works whether the name is split across two fields or stored as one, while single-word searches keep matching as before. --- .../settings/class-ur-members-list-table.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/includes/admin/settings/class-ur-members-list-table.php b/includes/admin/settings/class-ur-members-list-table.php index 0d025d5a4..09794c94b 100644 --- a/includes/admin/settings/class-ur-members-list-table.php +++ b/includes/admin/settings/class-ur-members-list-table.php @@ -1494,6 +1494,26 @@ public function urm_search_user_on_name( $query ) { $search_like ); + // Also match the full name (e.g. "John Smith") when first/last name are stored + // as separate usermeta rather than combined into a single field like display_name. + $search_conditions[] = $wpdb->prepare( + "EXISTS ( + SELECT 1 + FROM {$wpdb->usermeta} umfn + JOIN {$wpdb->usermeta} umln + ON umln.user_id = umfn.user_id + AND umln.meta_key = 'last_name' + WHERE umfn.user_id = {$wpdb->users}.ID + AND umfn.meta_key = 'first_name' + AND ( + CONCAT( umfn.meta_value, ' ', umln.meta_value ) LIKE %s + OR CONCAT( umln.meta_value, ' ', umfn.meta_value ) LIKE %s + ) + )", + $search_like, + $search_like + ); + $search_conditions[] = $wpdb->prepare( "EXISTS ( SELECT 1