You are here

function mass_contact_permission in Mass Contact 7

Implements hook_permission().

File

./mass_contact.module, line 95
This is the main code file for the Mass Contact module.

Code

function mass_contact_permission() {
  $permissions = array(
    'mass contact administer' => array(
      'title' => t('Administer Mass Contact'),
      'description' => t('Allows the user to add, change & delete categories and to change the administrative settings of Mass Contact.'),
    ),
    'mass contact archive messages' => array(
      'title' => t('Archive messages as content'),
      'description' => t('Allows the message sender to save an archive copy of the message as a node.'),
    ),
    'mass contact include attachments' => array(
      'title' => t('Attach files to messages'),
      'description' => t('Allows the message sender to include attachments with the message.'),
    ),
    'mass contact change default sender information' => array(
      'title' => t('Change default sender information'),
      'description' => t('Allows the message sender to change the default sender name and email address.'),
    ),
    'mass contact override archiving' => array(
      'title' => t('Override message archival setting'),
      'description' => t('Allows the message sender to override the "Archive messages by saving a copy as a node" administrative setting when creating the message.'),
    ),
    'mass contact override bcc' => array(
      'title' => t('Override BCC setting'),
      'description' => t('Allows the message sender to override the "Send as BCC (hide recipients) by default" administrative setting when creating the message.'),
    ),
    'mass contact override text format' => array(
      'title' => t('Override default text format'),
      'description' => t("Allows the message sender to override the message body's default text format when creating the message."),
    ),
    'mass contact send messages' => array(
      'title' => t('Send messages with Mass Contact'),
      'description' => t('Allows the user to send messages with the Mass Contact.'),
    ),
  );
  $result = db_select('mass_contact', 'mc')
    ->fields('mc', array(
    'category',
  ))
    ->execute();
  if (!empty($result)) {
    foreach ($result as $category) {
      $permission = 'mass contact send to users in the ' . $category->category . ' category';
      $permissions[$permission] = array(
        'title' => t('Send to users in the @category category', array(
          '@category' => $category->category,
        )),
        'description' => t('Allows the user to send messages to the users in the @category category', array(
          '@category' => $category->category,
        )),
      );
    }
  }
  return $permissions;
}