diff options
-rw-r--r-- | include/enotify.php | 17 | ||||
-rw-r--r-- | mod/settings.php | 5 | ||||
-rwxr-xr-x | view/tpl/settings.tpl | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/include/enotify.php b/include/enotify.php index f3eb80117..3fef3ba0a 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -357,9 +357,21 @@ function notification($params) { // create notification entry in DB + $seen = 0; + + // Mark some notifications as seen right away + // Note! The notification have to be created, because they are used to send emails + // So easiest solution to hide them from Notices is to mark them as seen right away. + // Another option would be to not add them to the DB, and change how emails are handled (probably would be better that way) + $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices'); + if(!$always_show_in_notices) { + if(($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) { + $seen = 1; + } + } - $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,type,verb,otype) - values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,'%s','%s')", + $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,seen,type,verb,otype) + values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')", dbesc($datarray['hash']), dbesc($datarray['name']), dbesc($datarray['url']), @@ -369,6 +381,7 @@ function notification($params) { intval($datarray['uid']), dbesc($datarray['link']), dbesc($datarray['parent']), + intval($seen), intval($datarray['type']), dbesc($datarray['verb']), dbesc($datarray['otype']) diff --git a/mod/settings.php b/mod/settings.php index ea7b2ba06..be6f2cfb9 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -449,6 +449,8 @@ function settings_post(&$a) { if(x($_POST,'vnotify11')) $vnotify += intval($_POST['vnotify11']); + $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0; + $channel = $a->get_channel(); $err = ''; @@ -478,6 +480,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','blocktags',$blocktags); set_pconfig(local_user(),'system','channel_menu',$channel_menu); set_pconfig(local_user(),'system','vnotify',$vnotify); + set_pconfig(local_user(),'system','always_show_in_notices',$always_show_in_notices); set_pconfig(local_user(),'system','evdays',$evdays); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d", @@ -995,6 +998,7 @@ function settings_content(&$a) { $permissions_role = get_pconfig(local_user(),'system','permissions_role'); $permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false); $vnotify = get_pconfig(local_user(),'system','vnotify'); + $always_show_in_notices = get_pconfig(local_user(),'system','always_show_in_notices'); if($vnotify === false) $vnotify = (-1); @@ -1080,6 +1084,7 @@ function settings_content(&$a) { '$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended')), '$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended')), '$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, ''), + '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, ''), '$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')), diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl index 7fa52677b..47d85d8e4 100755 --- a/view/tpl/settings.tpl +++ b/view/tpl/settings.tpl @@ -113,6 +113,8 @@ {{include file="field_intcheckbox.tpl" field=$vnotify7}} {{include file="field_intcheckbox.tpl" field=$vnotify8}} {{include file="field_intcheckbox.tpl" field=$vnotify9}} +{{include file="field_intcheckbox.tpl" field=$vnotify11}} +{{include file="field_intcheckbox.tpl" field=$always_show_in_notices}} {{*include file="field_intcheckbox.tpl" field=$vnotify11*}} </div> |