CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Searching for all name fields (like Quick Search) in a profile
Pages: [1]

Author Topic: Searching for all name fields (like Quick Search) in a profile  (Read 1217 times)

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Searching for all name fields (like Quick Search) in a profile
February 23, 2014, 03:33:54 am
Hello fellow Civi-people!

I'm putting together a membership directory for our NGO (the International Council for Traditional Music, www.ictmusic.org) with Drupal 4.1.5 and Drupal 6.x (and before you say anything about the installation not being the 'latest and greatest', it's a configuration I inherited, and which is won't likely be able to change  :-X ).

Our membership is spread all over the world, where diverse personal naming systems are used. For example, we have members having only one name, others with many given names but no family name, and people with both given and family names, but with alternative display orders (last_name, first_name or last_name, middle_name, firstname). A very challenging issue indeed, but one which I have handled gloriously using CiviCRM's robust addressee options. Whenever we print labels, every field is printed and in the correct order!

However, we're now opening CiviCRM's data to our members using Profiles, and I've been hitting a wall when trying to implement an extensive search.

What I need is a search that presents only 1 text field to our members, but which searches in several fields (i.e., first, middle, and last names, optionally primary e-mail address and nickname). Indeed, having three individual search fields (first, middle, and last name) won't work -- our beta testers are confirming it is too confusing.

In short, what I need to implement is a search very much like the Quick Search found at the top left of CiviCRM's admin console. I have tried many different approaches to make that happen (e.g., creating a custom field updated via a hook to have all the information I need, then adding it to the Profile; using the addressee field as part of the Profile, etc.), but always unsuccessfully.

I think such a 'global name search' in Profiles would be quite a popular option to have, so I wonder whether its functionality is built-in somewhere? An API maybe? If anybody could point me in the right direction, it would help me a lot.

Thanks a lot for reading this, and all the best from Slovenia!

Carlos Yoder
Executive Assistant — ICTM Secretariat
secretariat@ictmusic.org
www.ictmusic.org

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Searching for all name fields (like Quick Search) in a profile
February 23, 2014, 04:19:34 pm
What screen are you doing your data entry from - something like that is now part of event & membership forms (in 4.4 with cid=0 on the URL).  Note that 4.4 DOES work with drupal6 - some people have under the impression it doesn't.

I'm not sure I'm completely following your question though. ie. your member is searching for ?someone? when they fill in their details at a url like http://drupal.demo.civicrm.org/civicrm/profile/create?gid=14&reset=1 ?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Searching for all name fields (like Quick Search) in a profile
February 23, 2014, 11:03:51 pm
Thanks for your reply, Eileen!

Quote from: Eileen on February 23, 2014, 04:19:34 pm
What screen are you doing your data entry from - something like that is now part of event & membership forms (in 4.4 with cid=0 on the URL).  Note that 4.4 DOES work with drupal6 - some people have under the impression it doesn't.

I'm using one Profile (id=1) to take care of the Search, Edit, and View operations, as recommended in the CiviCRM book .The profile is set to Standalone Form or Directory, Drupal User Registration, View/Edit Drupal User Account, and -by default- CiviContribute.

The home URL of the membership directory  /civicrm/profile?gid=1&reset=1, and Edit screens have the pattern /civicrm/profile/edit?reset=1&pv=1&id=XXX&gid=1

In order to show only Current members in the Directory, I limit listings to a specific Smart Group (where MemStatus is either Current or Grace).

I'm attaching a screenshot of the current Search form I have, with those three separate search fields (given, middle, and last name) that I need to join into one (and thanks for the tip regarding CiviCRM 4.4 running on Drupal 6. Indeed I was under the impression Drupal 6 had been left behind).

Quote from: Eileen on February 23, 2014, 04:19:34 pm
I'm not sure I'm completely following your question though. ie. your member is searching for ?someone? when they fill in their details at a url like http://drupal.demo.civicrm.org/civicrm/profile/create?gid=14&reset=1 ?

The membership directory searches for individuals only, having a membership status of Current or Grace. They use either /profile/create or /profile/edit to manage their data.

Hope this helps in clarifying the matter!

Thanks a lot,

Carlos


Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Searching for all name fields (like Quick Search) in a profile
February 24, 2014, 11:50:39 am
Is it not acceptable to put 'display name' as the search field instead of (or even as well as) the individual name fields?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 01:25:43 am
That was one of my first ideas, but display_name is not a field I can add to a Profile -- at least in CiviCRM 4.1.5 and 4.2.4. Maybe that was added to 4.3 or 4.4? If so, I'll update a test installation and check!

Thanks a lot,

Carlos

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 01:57:26 am
I guess what I would like to know how to do is override the Profile Search code, and run my own SQL against the database. Is there a way to do that?

Thanks again!

Carlos

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 10:18:43 am
you could use Views - then you can expose the Display Name - or even make a composite search field off First and Last - at least in D7 you can do the latter but expect it is in latter D6 Views releases
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 01:01:10 pm
Thanks for that, but I was trying to stay away from Views (they're slow!).

Anyway, I found a workaround! It turns out you CAN add display_name to a Profile, but not through the standard web interface (God/Lobo knows why!).

So, you can add a new field (field_name='display_name') to the table, and voilà, it appears in the search form, and searches by display_name + primary e-mail! (probably that preference gets pulled from Search Preferences)! The only extra I had to do is hide that new field from the Edit screen (by adding necessary CSS to templates/CRM/Profile/Form/profile_id/Dynamic.tpl.

I'll keep on testing it, but it seems like my problem is solved! Thanks everyone!

Best,

Carlos

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 01:13:14 pm
nice solution
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Searching for all name fields (like Quick Search) in a profile
February 25, 2014, 11:07:44 pm
It is, isn't it? I just wonder about the reasons why that feature is not documented -- certainly I'm not the only one wanting to search contacts by  display_name...

Have a good day,

Carlos

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Searching for all name fields (like Quick Search) in a profile

This forum was archived on 2017-11-26.