summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2018-10-31 13:27:31 (GMT)
committerhass2018-10-31 13:27:31 (GMT)
commit9516a0a001b94e3bbb0e3e12c6b5d700b6418fb7 (patch)
treed171e6823fe34d5f0664d1de132c128e4e64145d
parent109f69b2b0fb0668b547572887264aa220208e09 (diff)
Make the default install more user and GDPR friendly.
-rw-r--r--google_analytics.install14
1 files changed, 14 insertions, 0 deletions
diff --git a/google_analytics.install b/google_analytics.install
index 259bf2c..d9bd9c9 100644
--- a/google_analytics.install
+++ b/google_analytics.install
@@ -6,6 +6,20 @@
*/
use Drupal\Core\Url;
+use Drupal\user\Entity\Role;
+
+/**
+ * Implements hook_install().
+ */
+function google_analytics_install() {
+ // Make the default install more user and GDPR friendly.
+ $role = Role::load('authenticated');
+ $role->grantPermission('opt-in or out of matomo tracking');
+ $success = $role->save();
+ if ($success) {
+ drupal_set_message(t('Module %module granted %permission permission to authenticated users.', ['%module' => 'Matomo Analytics', '%permission' => t('Opt-in or out of tracking')]), 'status');
+ }
+}
/**
* Implements hook_uninstall().