You are here

private function wf_crm_webform_preprocess::showNotYouMessage in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_webform_preprocess.inc \wf_crm_webform_preprocess::showNotYouMessage()

Displays the admin-defined message with "not you?" link to known contacts

Parameters

string $message: Raw message with tokens

array $contact: CiviCRM contact array

1 call to wf_crm_webform_preprocess::showNotYouMessage()
wf_crm_webform_preprocess::alterForm in includes/wf_crm_webform_preprocess.inc
Alter front-end of webforms: Called by hook_form_alter() when rendering a civicrm-enabled webform Add custom prefix. Display messages. Block users who should not have access. Set webform default values.

File

includes/wf_crm_webform_preprocess.inc, line 835

Class

wf_crm_webform_preprocess

Code

private function showNotYouMessage($message, $contact) {
  $message = $this
    ->replaceTokens($message, $contact);
  preg_match_all('#\\{([^}]+)\\}#', $message, $matches);
  if (!empty($matches[0])) {
    $q = $_GET;
    unset($q['q'], $q['cs'], $q['cid'], $q['cid1']);
    if (empty($_GET['cid']) && empty($_GET['cid1'])) {
      $q['cid1'] = 0;
    }
    foreach ($matches[0] as $pos => $match) {
      $link = l($matches[1][$pos], $_GET['q'], array(
        'query' => $q,
        'alias' => TRUE,
      ));
      $message = str_replace($match, $link, $message);
    }
  }
  $this
    ->setMessage($message);
}