I have a use case where there are public and non public events. Public events should be seen by everyone and can be registered for. Non public events should only be seen and registerable for a certain group (members.

With ACLs I deactivated the CMS permissions and added the rights to view / edit an event. I got as far as to create a seperate ACL for each event which grants the appropriate right in order to make an event public / non-public. This process however is very tedious since it required the creation of a seperate ACL for each event. Is there a way to make this more "global" so that events of a certain category (custom field) are public while others are non public?

1 Answer 1


You could apply the same techniques for event pages that are described for contribution pages here: Are private contribution pages a thing?.

EDIT: Actually that's only a piece of the puzzle, let me give an example (and make it CMS-agnostic). Assuming you want to limit access to members of "Newsletter Subscribers"

function hook_civicrm_preProcess($formName, &$form) {

  $redirectPath = 'home';  // set this to the url to redirect to if access is denied

  if ($formName == "CRM_Event_Form_Registration_Register") {
    $contactId = CRM_Core_Session::singleton()->getLoggedInContactID();
    $result = civicrm_api3('Contact', 'get', array(
      'group' => "Newsletter Subscribers",
      'id' => $contactId,
    if ($result['count'] === 0) {

Note: This will hide ALL event registrations. You'll have to find a variable in the $form object to use to determine whether this code should run on a particular page and modify the if condition.

  • Is there a specific technique you are referring to? Checked this thread before but haven't seen a solution/technique to solve this problem. Feb 2, 2018 at 14:38
  • @floriannorbertbepunkt I updated my answer. Feb 2, 2018 at 16:11
  • okay, I get what you mean. thank you for posting the example… my question was about a different approach: tieing an ACL to a custom field of an event (or more general extending an acls functionality to include conditional checks). with your approach you would not use ACLs at all but implement a query to conditionally show the data. Feb 2, 2018 at 16:19
  • Yes, that's correct. I understand what you're asking for - and even have the same need myself! This is higher-performance than ACLs, but I agree that what you're asking for is more user-friendly. Feb 2, 2018 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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