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.
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.)
- Create a group called systemhidden
- Create a group called Hidden as child of systemhidden
- Hide the the group systemhidden via the api -> see answer of Jon G
- To hide a smartgroup simply add it as a child of the group Hidden
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.