pfaffman
(Jay Pfaffman)
8 Giugno 2026, 10:34pm
1
Ho diversi campi personalizzati per gli utenti che il cliente desidera poter cercare per trovare gli utenti.
Se digito una / o uso la ricerca in alto nella pagina, vengono cercati anche i campi personalizzati e vengono trovati gli utenti attesi, ma cercando in /u viene cercato solo il nome utente.
La ricerca sta chiamando qualcosa del genere:
https://hostname/directory_items?period=all&order=likes_received&name=cutr&cards=yes&user_field_ids=6%7C7%7C8%7C1%7C3&plugin_column_ids=15%7C11
Sono quasi certo che questo funzionasse in precedenza e che si tratti di un regresso.
3 Mi Piace
Non sono riuscito a capire quando funzionasse, ma sono riuscito a correggere (o meglio, a rendere coerenti) entrambi i percorsi del codice.
main ← directory-search-custom-fields
opened 05:04PM - 09 Jun 26 UTC
Previously, the user directory (`/u`) search only matched usernames -- it never … found people by their *searchable* user custom field values (e.g. "Company" or "Member ID"), even though the quick search did. The gap appeared whenever `enable_names` was off or the term contained `_`, `.` or `-`, so member IDs, emails and phone numbers never matched.
This change lets the directory search those fields too, via an opt-in `search_custom_fields:` option on `UserSearch` that searches the `user_search_data` tsvector (mention autocomplete and chat are unchanged). It also escapes `LIKE` wildcards in the search term with `sanitize_sql_like`, and adds a tooltip warning that the "Searchable" toggle makes a field's value publicly findable in search.
Reported at https://meta.discourse.org/t/trouble-searching-user-custom-fields/404800
1 Mi Piace