You are here

function redhen_engagement_rules_action_score_contact in RedHen CRM 7

Helper function for saving a comment engagement score when the Rule action is triggered.

3 calls to redhen_engagement_rules_action_score_contact()
redhen_engagement_rules_action_score_by_mail in modules/redhen_engagement/redhen_engagement.rules.inc
Rules action: score an engagement by email address.
redhen_engagement_rules_action_score_by_uid in modules/redhen_engagement/redhen_engagement.rules.inc
Rules action: score an engagement by user ID.
redhen_engagement_rules_action_score_webform in modules/redhen_engagement/redhen_engagement.rules.inc
Helper function for when the "webform engagement" Rule action is triggered.

File

modules/redhen_engagement/redhen_engagement.rules.inc, line 108
Rules integration for RedHen Engagements.

Code

function redhen_engagement_rules_action_score_contact($score_ids, $contact, $description = '', $entity_type, $entity_id) {
  foreach ($score_ids as $id) {
    $score = entity_load_single('redhen_engagement_score', $id);
    $engagement = redhen_engagement_create($score->name, $contact->contact_id, $description, $entity_type, $entity_id);
    redhen_engagement_save($engagement);
  }
}