You are here

function redhen_contact_user_email_setting in RedHen CRM 7

Utility function for checking settings related to contact->user connections.

Parameters

string $setting: Setting string - should be a REDHEN_CONTACT_* setting constant.

object $contact: Contact object.

Return value

bool True if setting is enabled for connecting the contact to user, else false.

5 calls to redhen_contact_user_email_setting()
RedhenContact::save in modules/redhen_contact/lib/redhen_contact.entity.inc
Override parent::save() to manage user association.
redhen_contact_contact_form in modules/redhen_contact/includes/redhen_contact.forms.inc
Form callback: create or edit a contact.
redhen_contact_contact_form_validate in modules/redhen_contact/includes/redhen_contact.forms.inc
Validation callback for redhen_contact_contact_form().
redhen_contact_form_user_profile_form_alter in modules/redhen_contact/redhen_contact.module
Implements hook_form_FORM_ID_alter().
redhen_fields_field_validate in modules/redhen_fields/redhen_fields.module
Implements hook_field_validate().

File

modules/redhen_contact/redhen_contact.module, line 975
Module file for RedHen contacts.

Code

function redhen_contact_user_email_setting($setting, $contact) {
  $user_email_type = variable_get(REDHEN_CONTACT_USER_EMAIL_TYPE, array());
  if ($user_email_type && isset($contact->type) && !in_array($contact->type, $user_email_type)) {
    return FALSE;
  }
  switch ($setting) {
    case REDHEN_CONTACT_REQUIRE_EMAIL:
      return variable_get($setting, TRUE);
  }
  return variable_get($setting, FALSE);
}