Symptom:
The site I'm working on has user generation either 1) manually by admins (often drush) or 2) automatically when a user signs on using the shib_auth module (which creates a drupal user and an authmap entry). Because neither methods bring up the registration form, there is no way to set Notify defaults for new accounts.

Desired behavior:
There should be an admin setting to enforce Notify defaults for admin/automatically generated accounts. Alternately Notify module can provide "set notify defaults", "enable notify" and "disable notify" as Actions that site-admins can Trigger as they please using core functionality. I realize this post is very similar to an unresolved post from last year (#870812: Notify module admin settings on registration, adding defaults and details permission), but I've started a new thread because of a slightly different approach.

Current Workaround (inspired by #870812 and Writing Actions):
For those looking for an immediate fix, this can be done using the Rules module. Create a rule for when a user is generated and choose to conduct an Action (Custom PHP Code). Use the following code *without* the php tags to generate your custom action (this Action works for both auto-generated accounts and admin-generated accounts and hard-codes the defaults in the query):

  // get the uid for the registered user if admin generates account
  if (isset($account->uid)) {
    $uid = $account->uid;
  }
  else {
  // get the uid for user
    global $user;
    $uid = $user->uid;
  }
  // make sure user record exists
  if ($uid) {
    $user = user_load($uid);
    // set user notification defaults to nodes, comments, title only
    db_query("INSERT INTO {notify} VALUES(%d,1,1,1,0,0)", $uid);
    // record a message noting the action taken
    watchdog('action', 'Notify defaults set for user %name / uid=%uid.', array('%name' => check_plain($user->name), '%uid' => $uid));
  }

Comments and corrections welcome.

Comments

gisle’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Notify defaults is implemented in the Drupal 7 branch.

After three years, it is unlikely that this ever will be implemented in the Drupal 6 branch.