1

Is there a way to hide smart groups when searching in an advanced search and everywhere else? I have a lot of smart groups that i need to make but i don't want them searchable or accessible through a contact record.

1

The hidden group will only be accessible via the api.

An answer is to add a childgroup just before hiding it via the api.

All already existing childgroups of the hidden group won't be visible when adding a group to a contact, or when searching for contacts in a group. Under Contacts » Manage Groups the children of the hidden group won't be visible by default, but will be when you change a filter there (under Search groups). They will also be visible in an export of contacts in one of those groups. You can only view the groups contents via Contacts » Manage Groups or via Search » Search Builder.

(You can't add contacts to a children group of a hidden group, so this is only usable for smart groups.)

  1. Create a group called systemhidden
  2. Create a group called Hidden as child of systemhidden
  3. Hide the the group systemhidden via the api -> see answer of Jon G
  4. To hide a smartgroup simply add it as a child of the group Hidden
  • Both options worked but i wonder if hidden smart groups are updated like ones that are not hidden. I have this on a dev site with cron turned off so what do you think? I may have to test on my live site. – WVMike Aug 3 '17 at 19:37
  • @WVMike I don't know – Holland Open Source Aug 4 '17 at 11:48
2

There is an is_hidden flag on the civicrm_group table. It's used for temporary smart groups created for mailings - but I strongly suspect that you can use it for this purpose as well without meaningful side effects.

If you know how to edit your database directly, and understand the risks of doing so, you can set it that way. To do it through the web interface, you can use the API Explorer to access the hidden settings. Note that this is risky - take a backup before you do this, and test first on a test copy of your site!

  • Go to Contacts » Manage Groups.
  • Mouse over the Settings link next to the group you'd like to hide. At the bottom of your screen, look at the URL that appears, which will look something like: http://example.org/civicrm/group/search?reset=1&force=1&context=smog&gid=7. Note the number after gid= ("7", in my example links). This is your group ID.
  • Go to Support menu » Developer » API Explorer.
  • Set the Entity to "Group", action to "create", Group ID to your group ID, and "Group is Hidden" to "Yes". See screenshot. You can use "Add Parameter" to add the second parameter.
  • Press "Execute".

That's it! Please report back here whether this meets your needs, so others can benefit as well.

API Explorer Group.create

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.