Hi,

This is an old issue for Notify. Could it be reborn ?

When a user add on site, notify is "off" for him by default.
This code patch will made news users in the Notify "ON" by default :

function notify_user($type, &$edit, &$user, $category = NULL) {
  switch ($type) {

    case 'insert':
      if (variable_get('notify_status',0)) {
        db_query('INSERT INTO {notify} (uid, status, node, teasers, comment) VALUES(%d,%d,%d,%d,%d)', $user->uid,
                 variable_get('notify_status',0), variable_get('notify_node',0), variable_get('notify_teasers',0),
                 variable_get('notify_comment',0));
      }
      break;

    case 'delete':
      db_query('DELETE FROM {notify} WHERE uid = %d', $user->uid);
      break;
  }
}

Comments

derieppe’s picture

Title: Nitify user by default » Notify user by default
Version: 5.x-2.x-dev » 5.x-1.x-dev

Hi,
Will this issue add to Notify ?
Regards.

NaX’s picture

I did it this way, but I am using 1.2.

    case 'insert':
      if ($user->uid) {
        db_query('INSERT INTO {notify} (uid, status, node, teasers, comment) VALUES(%d,%d,%d,%d,%d)', $user->uid, 1, 1, 0, 1);
      }
      break;
hallman’s picture

I'm using 5.x-1.x-dev, v 2.1.2.2 2009/02/03. I added the code I found in the patch at http://drupal.org/node/92206 #9. I like it better than the changes recommended above because I run multiple sites from one installation and the patch code adds options to admin/content/notify so that each site can have its own default settings. The patch code adds to

function notify_admin_settings the following:

$form['notify_status'] = array('#type' => 'radios',
'#title' => t('Notify status'),
'#default_value' => variable_get('notify_status',0),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Default status setting for new users'),
);

$form['notify_node'] = array('#type' => 'radios',
'#title' => t('Notify new content'),
'#default_value' => variable_get('notify_node',0),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Include new content in the notification mail.'),
);
$form['notify_teasers'] = array('#type' => 'radios',
'#title' => t('Content'),
'#default_value' => variable_get('notify_teasers',0),
'#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body')),
'#description' => t('Select the amount of each post that you would like to see in your notification e-mails.'),
);
$form['notify_comment'] = array('#type' => 'radios',
'#title' => t('Notify new comments'),
'#default_value' => variable_get('notify_comment',0),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Include new comments in the notification mail.'),
);

and to function notify_user the following:

case 'insert':
if (variable_get('notify_status',0)) {
db_query('INSERT INTO {notify} (uid, status, node, teasers, comment) VALUES(%d,%d,%d,%d,%d)', $user->uid,
variable_get('notify_status',0), variable_get('notify_node',0), variable_get('notify_teasers',0),
variable_get('notify_comment',0));
}
break;

I'm not a php programmer, but I didn't have any trouble just pasting in these lines.

matt2000’s picture

Status: Active » Fixed

Current versions provide this as a configurable option.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.