Skip to Content Skip to Menu

[SOLVED] Search users by field value

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 year 10 months ago - 1 year 10 months ago #332323 by liaskas
[SOLVED] Search users by field value was created by liaskas
Hello
I have a custom field (named "position") for my users that takes about 20 different values (one for each user). This field is "query dropdown multiple select" and it gets it's options with the following query...
Code:
SELECT DISTINCT `cb_column` FROM `#__comprofiler` WHERE `cb_column` !='' ORDER BY `cb_column` ASC
The values are populated correctly from the database.

Now i want users to be able to search the userlist by selecting one or more options that are listed in this field.
For example... if user selects option "Technical" in position field to get a userlist with all the users that have "Technical" in their corresponding field.

No way....

I always get a blank search result!

Field settings:
- Searchable
- Selected in List / Parameters / Search

Can you please advise?

Also...
We need the same field to be visible only as a list search field. Not in profile, not in profile edit. So we have placed it in a tab that is in Position "Not displayed on profile 1". Even that the tab is positioned in "Not displayed on profile 1", it shows on profile edit. Can we avoid that somehow?...

Thank you...
Last edit: 1 year 10 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 10 months ago #332324 by krileon
Replied by krileon on topic Search users by field value
How are they supposed to select a value from the field for it to save in the database and for it to then be searched if they can't edit it? Your search is turning up no results because nobody can use the field and thus nobody has a value for that field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 year 10 months ago #332326 by liaskas
Replied by liaskas on topic Search users by field value
The value can be set for each user either in registration, or by an auto action based on another field value, or by CB Subs. There are ways of setting a value for each user!
What is sure is that there are values stored in the database for the users! In this case the values are stored through an auto action triggered by another field value.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 10 months ago #332327 by krileon
Replied by krileon on topic Search users by field value
When storing multiple values be sure you're separating them with a |*| delimiter. Example as follows.

VALUE_1|*|VALUE_2

Otherwise they won't store correctly and won't match an option. If they don't match an option they'll be removed from the search during searching. Trying having a user only have 1 option selected then searching for that option. With Joomla debug mode enabled check the debugger at the bottom of the page (or debug bar at bottom of window if J4) and review the userlist query (it will be against _users and _comprofiler) to be sure your field is in the query.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 year 10 months ago - 1 year 10 months ago #332328 by liaskas
Replied by liaskas on topic Search users by field value
This field does not tale multiple values...
Code:
SELECT *FROM ...

The field is in the query.
Last edit: 1 year 10 months ago by liaskas.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 10 months ago #332329 by krileon
Replied by krileon on topic Search users by field value
It's using AND. So it's trying to match multiple selections exactly. The field appears to be working perfectly fine. If all that criteria doesn't match then it won't find a user. Set your userlist to "simple any" instead of "simple is" or to "advanced" for it to use OR.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum