X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FMailingEventSubscribe.php;h=8e64faa365335488c923ba85c60046679bad88ce;hb=655da1f919af8318da84d80422841599c332024d;hp=7046fe166efc5679c5880685ac65e3d77792a171;hpb=8dda910479e13cefd34c155b00f107ca24a1ec50;p=civicrm-core.git diff --git a/api/v3/MailingEventSubscribe.php b/api/v3/MailingEventSubscribe.php index 7046fe166e..8e64faa365 100644 --- a/api/v3/MailingEventSubscribe.php +++ b/api/v3/MailingEventSubscribe.php @@ -38,6 +38,10 @@ function civicrm_api3_mailing_event_subscribe_create($params) { throw new API_Exception('Invalid Group id'); } + if (substr($group->visibility, 0, 6) != 'Public') { + throw new API_Exception('Group is not Public. Contact cannot be subscribed to this Group.'); + } + $subscribe = CRM_Mailing_Event_BAO_Subscribe::subscribe($group_id, $email, $contact_id); if ($subscribe !== NULL) {