[ticket/11103] Use PM Notification Preferences from Notification Options

Remove all PM Notification preferences from UCP Board Preferences

PHPBB3-11103
This commit is contained in:
Nathan Guse 2012-09-27 19:19:38 -05:00
parent 521992215c
commit ba7289b9d2
3 changed files with 11 additions and 57 deletions

View file

@ -85,25 +85,21 @@ class phpbb_notifications_type_pm extends phpbb_notifications_type_base
$notify_users = array(); $notify_users = array();
foreach (array_keys($pm['recipients']) as $user_id) $sql = 'SELECT *
FROM ' . USER_NOTIFICATIONS_TABLE . "
WHERE item_type = '" . self::get_item_type() . "'
AND " . $db->sql_in_set('user_id', array_keys($pm['recipients']));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{ {
$recipient = $service->get_user($user_id); if (!isset($rowset[$row['user_id']]))
if ($recipient['user_notify_pm'])
{ {
$notify_users[$recipient['user_id']] = array(); $notify_users[$row['user_id']] = array();
if ($recipient['user_notify_type'] == NOTIFY_EMAIL || $recipient['user_notify_type'] == NOTIFY_BOTH)
{
$notify_users[$recipient['user_id']][] = 'email';
} }
if ($recipient['user_notify_type'] == NOTIFY_IM || $recipient['user_notify_type'] == NOTIFY_BOTH) $notify_users[$row['user_id']][] = $row['method'];
{
$notify_users[$recipient['user_id']][] = 'jabber';
}
}
} }
$db->sql_freeresult($result);
return $notify_users; return $notify_users;
} }

View file

@ -37,7 +37,6 @@ class ucp_prefs
case 'personal': case 'personal':
add_form_key('ucp_prefs_personal'); add_form_key('ucp_prefs_personal');
$data = array( $data = array(
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true), 'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
'lang' => basename(request_var('lang', $user->data['user_lang'])), 'lang' => basename(request_var('lang', $user->data['user_lang'])),
'style' => request_var('style', (int) $user->data['user_style']), 'style' => request_var('style', (int) $user->data['user_style']),
@ -46,17 +45,9 @@ class ucp_prefs
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']), 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']), 'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']), 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
); );
if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml')))
{
// Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
$data['notifymethod'] = NOTIFY_BOTH;
}
if ($submit) if ($submit)
{ {
if ($config['override_user_style']) if ($config['override_user_style'])
@ -81,15 +72,11 @@ class ucp_prefs
if (!sizeof($error)) if (!sizeof($error))
{ {
$user->optionset('popuppm', $data['popuppm']);
$sql_ary = array( $sql_ary = array(
'user_allow_pm' => $data['allowpm'], 'user_allow_pm' => $data['allowpm'],
'user_allow_viewemail' => $data['viewemail'], 'user_allow_viewemail' => $data['viewemail'],
'user_allow_massemail' => $data['massemail'], 'user_allow_massemail' => $data['massemail'],
'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'], 'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
'user_notify_type' => $data['notifymethod'],
'user_notify_pm' => $data['notifypm'],
'user_options' => $user->data['user_options'], 'user_options' => $user->data['user_options'],
'user_dateformat' => $data['dateformat'], 'user_dateformat' => $data['dateformat'],
@ -135,15 +122,10 @@ class ucp_prefs
$template->assign_vars(array( $template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
'S_VIEW_EMAIL' => $data['viewemail'], 'S_VIEW_EMAIL' => $data['viewemail'],
'S_MASS_EMAIL' => $data['massemail'], 'S_MASS_EMAIL' => $data['massemail'],
'S_ALLOW_PM' => $data['allowpm'], 'S_ALLOW_PM' => $data['allowpm'],
'S_HIDE_ONLINE' => $data['hideonline'], 'S_HIDE_ONLINE' => $data['hideonline'],
'S_NOTIFY_PM' => $data['notifypm'],
'S_POPUP_PM' => $data['popuppm'],
'DATE_FORMAT' => $data['dateformat'], 'DATE_FORMAT' => $data['dateformat'],
'A_DATE_FORMAT' => addslashes($data['dateformat']), 'A_DATE_FORMAT' => addslashes($data['dateformat']),

View file

@ -39,30 +39,6 @@
</dd> </dd>
</dl> </dl>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_SELECT_NOTIFY -->
<dl>
<dt><label for="notifymethod0">{L_NOTIFY_METHOD}:</label></dt>
<dd>
<label for="notifymethod0"><input type="radio" name="notifymethod" id="notifymethod0" value="0"<!-- IF S_NOTIFY_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_EMAIL}</label>
<label for="notifymethod1"><input type="radio" name="notifymethod" id="notifymethod1" value="1"<!-- IF S_NOTIFY_IM --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_IM}</label>
<label for="notifymethod2"><input type="radio" name="notifymethod" id="notifymethod2" value="2"<!-- IF S_NOTIFY_BOTH --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_BOTH}</label>
</dd>
</dl>
<!-- ENDIF -->
<dl>
<dt><label for="notifypm1">{L_NOTIFY_ON_PM}:</label></dt>
<dd>
<label for="notifypm1"><input type="radio" name="notifypm" id="notifypm1" value="1"<!-- IF S_NOTIFY_PM --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label for="notifypm0"><input type="radio" name="notifypm" id="notifypm0" value="0"<!-- IF not S_NOTIFY_PM --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<dl>
<dt><label for="popuppm0">{L_POPUP_ON_PM}:</label></dt>
<dd>
<label for="popuppm1"><input type="radio" name="popuppm" id="popuppm1" value="1"<!-- IF S_POPUP_PM --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label for="popuppm0"><input type="radio" name="popuppm" id="popuppm0" value="0"<!-- IF not S_POPUP_PM --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<dl> <dl>
<dt><label for="lang">{L_BOARD_LANGUAGE}:</label></dt> <dt><label for="lang">{L_BOARD_LANGUAGE}:</label></dt>
<dd><select name="lang" id="lang">{S_LANG_OPTIONS}</select></dd> <dd><select name="lang" id="lang">{S_LANG_OPTIONS}</select></dd>