Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / user_cancel_methods_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/user_cancel_methods_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/user_cancel_methods_alter.twig
new file mode 100644 (file)
index 0000000..ca5d1d7
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Implements hook_user_cancel_methods_alter().
+ */
+function {{ machine_name }}_user_cancel_methods_alter(&$methods) {
+  // Limit access to disable account and unpublish content method.
+  $methods['user_cancel_block_unpublish']['access'] = user_access('administer site configuration');
+
+  // Remove the content re-assigning method.
+  unset($methods['user_cancel_reassign']);
+
+  // Add a custom zero-out method.
+  $methods['mymodule_zero_out'] = array(
+    'title' => t('Delete the account and remove all content.'),
+    'description' => t('All your content will be replaced by empty strings.'),
+    // access should be used for administrative methods only.
+    'access' => user_access('access zero-out account cancellation method'),
+  );
+}