You are here

public function WebformCivicrmPostProcess::setLoggingContact in Webform CiviCRM Integration 8.5

Identifies contact 1 as acting user for CiviCRM's advanced logging

1 call to WebformCivicrmPostProcess::setLoggingContact()
WebformCivicrmPostProcess::preSave in src/WebformCivicrmPostProcess.php
Process webform submission when it is about to be saved. Called by the following hook:

File

src/WebformCivicrmPostProcess.php, line 2696
Front-end form validation and post-processing.

Class

WebformCivicrmPostProcess

Namespace

Drupal\webform_civicrm

Code

public function setLoggingContact() {
  if (!empty($this->ent['contact'][1]['id']) && \Drupal::currentUser()
    ->isAnonymous()) {
    \CRM_Core_DAO::executeQuery('SET @civicrm_user_id = %1', [
      1 => [
        $this->ent['contact'][1]['id'],
        'Integer',
      ],
    ]);
  }
}