function notify_user_insert in Notify 2.0.x
Same name and namespace in other branches
- 8 notify.module \notify_user_insert()
- 7 notify.module \notify_user_insert()
- 1.0.x notify.module \notify_user_insert()
Implements hook_ENTIY_TYPE__insert().
File
- ./
notify.module, line 119 - Hooks for Notify module.
Code
function notify_user_insert(User $account) {
$uid = $account
->id();
$config = \Drupal::config('notify.settings');
$id = \Drupal::database()
->insert('notify')
->fields([
'uid' => $uid,
'status' => $config
->get('notify_reg_default'),
'node' => $config
->get('notify_def_node'),
'comment' => $config
->get('notify_def_comment'),
])
->execute();
// Get permitted node types.
$nodetypes = $config
->get('notify_nodetypes');
if ($nodetypes != NULL) {
foreach ($nodetypes as $ntype => $value) {
if ($value) {
\Drupal::database()
->insert('notify_subscriptions')
->fields([
'uid' => $uid,
'type' => $ntype,
])
->execute();
}
}
}
}