function simplenews_roles_user_insert in Simplenews Roles 7
Implements hook_user_insert().
File
- ./
simplenews_roles.module, line 103 - Synchronize user subscriptions based on user roles membership.
Code
function simplenews_roles_user_insert(&$edit, $account, $category) {
$roles = array_keys($account->roles);
foreach (variable_get('simplenews_roles_tids_rids', array()) as $tid => $rids) {
if (count(array_intersect($rids, $roles)) > 0) {
// If the user has role that matches the current subscription, subscribe.
simplenews_subscribe_user($account->mail, $tid, FALSE, 'simplenews_roles');
}
}
}