You are here

function mailchimp_campaign_access in Mailchimp 7.2

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_access()
  2. 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_access()
  3. 7.4 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_access()

Access callback for campaigns. Provides access to features based on whether or not a campaign has been sent.

Parameters

MailChimpCampaign $campaign:

bool $sent: Whether or not a campaign has been sent.

Return value

bool

1 string reference to 'mailchimp_campaign_access'
mailchimp_campaign_menu in modules/mailchimp_campaign/mailchimp_campaign.module
Implements hook_menu().

File

modules/mailchimp_campaign/mailchimp_campaign.module, line 120

Code

function mailchimp_campaign_access(MailChimpCampaign $campaign, $sent = TRUE) {
  $access = FALSE;

  // only campaigns that haven't been sent can be changed
  if (user_access('administer mailchimp campaigns') && ($campaign->mc_data['status'] === 'sent') === $sent) {
    $access = TRUE;
  }
  return $access;
}