{"id":1143,"date":"2015-07-08T09:09:41","date_gmt":"2015-07-08T14:09:41","guid":{"rendered":"http:\/\/agileadam.com\/?p=1143"},"modified":"2015-07-08T09:34:54","modified_gmt":"2015-07-08T14:34:54","slug":"disable-drupals-default-user-x-has-applied-for-an-account-email","status":"publish","type":"post","link":"https:\/\/agileadam.com\/2015\/07\/disable-drupals-default-user-x-has-applied-for-an-account-email\/","title":{"rendered":"Disable Drupal’s default “user X has applied for an account” email"},"content":{"rendered":"

By default Drupal sends an email to the site admin; it’s not editable (and you cannot disable it) from\u00a0the account settings page.<\/p>\n

On a recent project I had to use Rules to send some emails when a user registers for an account. Because I was already sending emails via Rules, I needed to disable the stock admin email. Here’s a quick way to do this:<\/p>\n

\/**\r\n * Implements hook_mail_alter().\r\n *\/\r\nfunction mymodule_mail_alter(&$message) {\r\n  switch ($message['id']) {\r\n    case 'user_register_pending_approval_admin':\r\n      \/\/ Don't send the default approval email to the admin (we're using Rules for this)\r\n      $message ['send'] = FALSE;\r\n      break;\r\n  }\r\n}<\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

By default Drupal sends an email to the site admin; it’s not editable (and you cannot disable it) from\u00a0the account settings page. On a recent project I had to use Rules to send some emails when a user registers for an account. Because I was already sending emails via Rules, I needed to disable the stock admin email. Here’s a quick way to do this: \/** * Implements hook_mail_alter(). *\/ function mymodule_mail_alter(&$message) { switch ($message[‘id’]) { case ‘user_register_pending_approval_admin’: \/\/ Don’t send the default approval email to the admin (we’re using Rules for this) $message [‘send’] = FALSE; break; } }  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[79],"tags":[84,83,56],"_links":{"self":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1143"}],"collection":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/comments?post=1143"}],"version-history":[{"count":7,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1143\/revisions"}],"predecessor-version":[{"id":1150,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1143\/revisions\/1150"}],"wp:attachment":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/media?parent=1143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/categories?post=1143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/tags?post=1143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}