Closed (fixed)
Project:
Notify
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Oct 2008 at 13:35 UTC
Updated:
14 Jun 2010 at 20:50 UTC
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
Comment #1
derieppe commentedHi,
Will this issue add to Notify ?
Regards.
Comment #2
NaX commentedI did it this way, but I am using 1.2.
Comment #3
hallman commentedI'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.
Comment #4
matt2000 commentedCurrent versions provide this as a configurable option.