You are here

function securesite_user_delete in Secure Site 8

Same name and namespace in other branches
  1. 7.2 securesite.module \securesite_user_delete()

Implements hook_user_delete(). TODO fix this

File

./securesite.module, line 179
Enables HTTP authentication or an HTML form to restrict site access.

Code

function securesite_user_delete($account) {
  $user = \Drupal::currentUser();
  $site_path = DrupalKernel::findSitePath(\Drupal::request());
  if (in_array(SECURESITE_DIGEST, \Drupal::config('securesite.settings')
    ->get('securesite_type'))) {
    $script = \Drupal::config('securesite.settings')
      ->get('securesite_password_script');
    $values = array(
      'username=' . escapeshellarg($user
        ->getUsername()),
      'realm=' . escapeshellarg(\Drupal::config('securesite.settings')
        ->get('securesite_realm')),
      'op=delete',
      'site_path=' . $site_path,
    );
    exec($script . ' ' . implode(' ', $values));
  }
}