|
@@ -992,7 +992,7 @@ function saveProfileChanges(&$profile_vars, &$post_errors, $memID)
|
|
|
{
|
|
|
makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']);
|
|
|
|
|
|
- makeNotificationChanges($memID);
|
|
|
+
|
|
|
if (!empty($_REQUEST['sa']))
|
|
|
makeCustomFieldChanges($memID, $_REQUEST['sa'], false);
|
|
|
|
|
@@ -1820,94 +1820,130 @@ function notification($memID)
|
|
|
{
|
|
|
global $txt, $scripturl, $user_profile, $user_info, $context, $modSettings, $smcFunc, $sourcedir, $settings;
|
|
|
|
|
|
-
|
|
|
- require_once($sourcedir . '/Subs-List.php');
|
|
|
+
|
|
|
+ loadCSSFile('admin.css', array(), 'admin');
|
|
|
|
|
|
-
|
|
|
- $listOptions = array(
|
|
|
- 'id' => 'board_notification_list',
|
|
|
- 'width' => '100%',
|
|
|
- 'no_items_label' => $txt['notifications_boards_none'] . '<br /><br />' . $txt['notifications_boards_howto'],
|
|
|
- 'no_items_align' => 'left',
|
|
|
- 'base_href' => $scripturl . '?action=profile;u=' . $memID . ';area=notification',
|
|
|
- 'default_sort_col' => 'board_name',
|
|
|
- 'get_items' => array(
|
|
|
- 'function' => 'list_getBoardNotifications',
|
|
|
- 'params' => array(
|
|
|
- $memID,
|
|
|
- ),
|
|
|
- ),
|
|
|
- 'columns' => array(
|
|
|
- 'board_name' => array(
|
|
|
- 'header' => array(
|
|
|
- 'value' => $txt['notifications_boards'],
|
|
|
- 'class' => 'lefttext first_th',
|
|
|
- ),
|
|
|
- 'data' => array(
|
|
|
- 'function' => create_function('$board', '
|
|
|
- global $settings, $txt;
|
|
|
+
|
|
|
+ $sa = array(
|
|
|
+ 'alerts' => 'alert_configuration',
|
|
|
+ 'topics' => 'alert_notifications_topics',
|
|
|
+ 'boards' => 'alert_notifications_boards',
|
|
|
+ );
|
|
|
|
|
|
- $link = $board[\'link\'];
|
|
|
+ $subAction = !empty($_GET['sa']) && isset($sa[$_GET['sa']]) ? $_GET['sa'] : 'alerts';
|
|
|
|
|
|
- if ($board[\'new\'])
|
|
|
- $link .= \' <a href="\' . $board[\'href\'] . \'"><span class="new_posts">' . $txt['new'] . '</span></a>\';
|
|
|
+ $context['sub_template'] = $sa[$subAction];
|
|
|
+ $context[$context['profile_menu_name']]['tab_data'] = array(
|
|
|
+ 'title' => $txt['notification'],
|
|
|
+ 'help' => '',
|
|
|
+ 'description' => $txt['notification_info'],
|
|
|
+ );
|
|
|
+ $sa[$subAction]($memID);
|
|
|
+}
|
|
|
|
|
|
- return $link;
|
|
|
- '),
|
|
|
- ),
|
|
|
- 'sort' => array(
|
|
|
- 'default' => 'name',
|
|
|
- 'reverse' => 'name DESC',
|
|
|
- ),
|
|
|
- ),
|
|
|
- 'delete' => array(
|
|
|
- 'header' => array(
|
|
|
- 'value' => '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />',
|
|
|
- 'style' => 'width: 4%;',
|
|
|
- 'class' => 'centercol',
|
|
|
- ),
|
|
|
- 'data' => array(
|
|
|
- 'sprintf' => array(
|
|
|
- 'format' => '<input type="checkbox" name="notify_boards[]" value="%1$d" class="input_check" />',
|
|
|
- 'params' => array(
|
|
|
- 'id' => false,
|
|
|
- ),
|
|
|
- ),
|
|
|
- 'class' => 'centercol',
|
|
|
- ),
|
|
|
- ),
|
|
|
+function alert_configuration($memID)
|
|
|
+{
|
|
|
+ global $txt, $scripturl, $user_profile, $user_info, $context, $modSettings, $smcFunc, $sourcedir, $settings;
|
|
|
+
|
|
|
+
|
|
|
+ $context['member'] += array(
|
|
|
+ 'notify_announcements' => $user_profile[$memID]['notify_announcements'],
|
|
|
+ 'notify_send_body' => $user_profile[$memID]['notify_send_body'],
|
|
|
+ 'notify_types' => $user_profile[$memID]['notify_types'],
|
|
|
+ 'notify_regularity' => $user_profile[$memID]['notify_regularity'],
|
|
|
+ );
|
|
|
+
|
|
|
+ loadThemeOptions($memID);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $alert_types = array(
|
|
|
+ 'msg' => array(
|
|
|
+ 'msg_mention' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ 'msg_quote' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ 'msg_like' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
),
|
|
|
- 'form' => array(
|
|
|
- 'href' => $scripturl . '?action=profile;area=notification;save',
|
|
|
- 'include_sort' => true,
|
|
|
- 'include_start' => true,
|
|
|
- 'hidden_fields' => array(
|
|
|
- 'u' => $memID,
|
|
|
- 'sa' => $context['menu_item_selected'],
|
|
|
- $context['session_var'] => $context['session_id'],
|
|
|
- ),
|
|
|
- 'token' => $context['token_check'],
|
|
|
+ 'pm' => array(
|
|
|
+ 'pm_new' => array('alert' => 'always', 'email' => 'yes', 'help' => 'alert_pm_new'),
|
|
|
+ 'pm_reply' => array('alert' => 'always', 'email' => 'yes', 'help' => 'alert_pm_new'),
|
|
|
),
|
|
|
- 'additional_rows' => array(
|
|
|
- array(
|
|
|
- 'position' => 'bottom_of_list',
|
|
|
- 'value' => '<input type="submit" name="edit_notify_boards" value="' . $txt['notifications_update'] . '" class="button_submit" />',
|
|
|
- 'align' => 'right',
|
|
|
- ),
|
|
|
+ 'moderation' => array(
|
|
|
+ 'msg_report' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ 'msg_report_reply' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ ),
|
|
|
+ 'members' => array(
|
|
|
+ 'register_new' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ 'warn_own' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ 'warn_any' => array('alert' => 'yes', 'email' => 'yes'),
|
|
|
+ ),
|
|
|
+ 'calendar' => array(
|
|
|
+ 'event_new' => array('alert' => 'yes', 'email' => 'yes', 'help' => 'alert_event_new'),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ $group_options = array(
|
|
|
+ 'msg' => array(
|
|
|
+ array('check', 'msg_auto_notify', 'label' => 'after'),
|
|
|
+ array('select', 'msg_notify_pref', 'label' => 'before', 'opts' => array(
|
|
|
+ 'nothing' => $txt['alert_opt_msg_notify_pref_nothing'],
|
|
|
+ 'instant' => $txt['alert_opt_msg_notify_pref_instant'],
|
|
|
+ 'first' => $txt['alert_opt_msg_notify_pref_first'],
|
|
|
+ 'daily' => $txt['alert_opt_msg_notify_pref_daily'],
|
|
|
+ 'weekly' => $txt['alert_opt_msg_notify_pref_weekly'],
|
|
|
+ )),
|
|
|
),
|
|
|
);
|
|
|
+
|
|
|
+
|
|
|
+ call_integration_hook('integrate_alert_types', array(&$alert_types, &$group_options));
|
|
|
+ $context['alert_types'] = $alert_types;
|
|
|
+ $context['alert_group_options'] = $group_options;
|
|
|
|
|
|
-
|
|
|
- createList($listOptions);
|
|
|
+ if (isset($_POST['saving or something']))
|
|
|
+ {
|
|
|
+ is_not_guest();
|
|
|
+ if (!$context['member']['is_owner'])
|
|
|
+ isAllowedTo('profile_extra_any');
|
|
|
+ checkSession('post');
|
|
|
+ validateToken(str_replace('%u', $memID, 'profile-nt%u'), 'post');
|
|
|
+
|
|
|
+ makeNotificationChanges($memID);
|
|
|
+ $context['profile_updated'] = $txt['profile_updated_own'];
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ $context['token_check'] = str_replace('%u', $memID, 'profile-nt%u');
|
|
|
+ createToken($context['token_check'], 'post');
|
|
|
+}
|
|
|
+
|
|
|
+function alert_notifications_topics($memID)
|
|
|
+{
|
|
|
+ global $txt, $scripturl, $user_profile, $user_info, $context, $modSettings, $smcFunc, $sourcedir, $settings;
|
|
|
+
|
|
|
+
|
|
|
+ if (isset($_POST['edit_notify_topics']))
|
|
|
+ {
|
|
|
+ checkSession('post');
|
|
|
+ validateToken(str_replace('%u', $memID, 'profile-nt%u'), 'post');
|
|
|
+
|
|
|
+ makeNotificationChanges($memID);
|
|
|
+ $context['profile_updated'] = $txt['profile_updated_own'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $context['token_check'] = str_replace('%u', $memID, 'profile-nt%u');
|
|
|
+ createToken($context['token_check'], 'post');
|
|
|
+
|
|
|
+
|
|
|
+ require_once($sourcedir . '/Subs-List.php');
|
|
|
+
|
|
|
+
|
|
|
$listOptions = array(
|
|
|
'id' => 'topic_notification_list',
|
|
|
'width' => '100%',
|
|
|
'items_per_page' => $modSettings['defaultMaxMessages'],
|
|
|
'no_items_label' => $txt['notifications_topics_none'] . '<br /><br />' . $txt['notifications_topics_howto'],
|
|
|
'no_items_align' => 'left',
|
|
|
- 'base_href' => $scripturl . '?action=profile;u=' . $memID . ';area=notification',
|
|
|
+ 'base_href' => $scripturl . '?action=profile;u=' . $memID . ';area=notification;sa=topics',
|
|
|
'default_sort_col' => 'last_post',
|
|
|
'get_items' => array(
|
|
|
'function' => 'list_getTopicNotifications',
|
|
@@ -1996,7 +2032,7 @@ function notification($memID)
|
|
|
),
|
|
|
),
|
|
|
'form' => array(
|
|
|
- 'href' => $scripturl . '?action=profile;area=notification;save',
|
|
|
+ 'href' => $scripturl . '?action=profile;area=notification;sa=topics',
|
|
|
'include_sort' => true,
|
|
|
'include_start' => true,
|
|
|
'hidden_fields' => array(
|
|
@@ -2017,16 +2053,105 @@ function notification($memID)
|
|
|
|
|
|
|
|
|
createList($listOptions);
|
|
|
+}
|
|
|
|
|
|
-
|
|
|
- $context['member'] += array(
|
|
|
- 'notify_announcements' => $user_profile[$memID]['notify_announcements'],
|
|
|
- 'notify_send_body' => $user_profile[$memID]['notify_send_body'],
|
|
|
- 'notify_types' => $user_profile[$memID]['notify_types'],
|
|
|
- 'notify_regularity' => $user_profile[$memID]['notify_regularity'],
|
|
|
+function alert_notifications_boards($memID)
|
|
|
+{
|
|
|
+ global $txt, $scripturl, $user_profile, $user_info, $context, $modSettings, $smcFunc, $sourcedir, $settings;
|
|
|
+
|
|
|
+
|
|
|
+ if (isset($_POST['edit_notify_boards']))
|
|
|
+ {
|
|
|
+ checkSession('post');
|
|
|
+ validateToken(str_replace('%u', $memID, 'profile-nt%u'), 'post');
|
|
|
+
|
|
|
+ makeNotificationChanges($memID);
|
|
|
+ $context['profile_updated'] = $txt['profile_updated_own'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $context['token_check'] = str_replace('%u', $memID, 'profile-nt%u');
|
|
|
+ createToken($context['token_check'], 'post');
|
|
|
+
|
|
|
+
|
|
|
+ require_once($sourcedir . '/Subs-List.php');
|
|
|
+
|
|
|
+
|
|
|
+ $listOptions = array(
|
|
|
+ 'id' => 'board_notification_list',
|
|
|
+ 'width' => '100%',
|
|
|
+ 'no_items_label' => $txt['notifications_boards_none'] . '<br /><br />' . $txt['notifications_boards_howto'],
|
|
|
+ 'no_items_align' => 'left',
|
|
|
+ 'base_href' => $scripturl . '?action=profile;u=' . $memID . ';area=notification;sa=boards',
|
|
|
+ 'default_sort_col' => 'board_name',
|
|
|
+ 'get_items' => array(
|
|
|
+ 'function' => 'list_getBoardNotifications',
|
|
|
+ 'params' => array(
|
|
|
+ $memID,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 'columns' => array(
|
|
|
+ 'board_name' => array(
|
|
|
+ 'header' => array(
|
|
|
+ 'value' => $txt['notifications_boards'],
|
|
|
+ 'class' => 'lefttext first_th',
|
|
|
+ ),
|
|
|
+ 'data' => array(
|
|
|
+ 'function' => create_function('$board', '
|
|
|
+ global $settings, $txt;
|
|
|
+
|
|
|
+ $link = $board[\'link\'];
|
|
|
+
|
|
|
+ if ($board[\'new\'])
|
|
|
+ $link .= \' <a href="\' . $board[\'href\'] . \'"><span class="new_posts">' . $txt['new'] . '</span></a>\';
|
|
|
+
|
|
|
+ return $link;
|
|
|
+ '),
|
|
|
+ ),
|
|
|
+ 'sort' => array(
|
|
|
+ 'default' => 'name',
|
|
|
+ 'reverse' => 'name DESC',
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 'delete' => array(
|
|
|
+ 'header' => array(
|
|
|
+ 'value' => '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />',
|
|
|
+ 'style' => 'width: 4%;',
|
|
|
+ 'class' => 'centercol',
|
|
|
+ ),
|
|
|
+ 'data' => array(
|
|
|
+ 'sprintf' => array(
|
|
|
+ 'format' => '<input type="checkbox" name="notify_boards[]" value="%1$d" class="input_check" />',
|
|
|
+ 'params' => array(
|
|
|
+ 'id' => false,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 'class' => 'centercol',
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 'form' => array(
|
|
|
+ 'href' => $scripturl . '?action=profile;area=notification;sa=boards',
|
|
|
+ 'include_sort' => true,
|
|
|
+ 'include_start' => true,
|
|
|
+ 'hidden_fields' => array(
|
|
|
+ 'u' => $memID,
|
|
|
+ 'sa' => $context['menu_item_selected'],
|
|
|
+ $context['session_var'] => $context['session_id'],
|
|
|
+ ),
|
|
|
+ 'token' => $context['token_check'],
|
|
|
+ ),
|
|
|
+ 'additional_rows' => array(
|
|
|
+ array(
|
|
|
+ 'position' => 'bottom_of_list',
|
|
|
+ 'value' => '<input type="submit" name="edit_notify_boards" value="' . $txt['notifications_update'] . '" class="button_submit" />',
|
|
|
+ 'align' => 'right',
|
|
|
+ ),
|
|
|
+ ),
|
|
|
);
|
|
|
|
|
|
- loadThemeOptions($memID);
|
|
|
+
|
|
|
+ createList($listOptions);
|
|
|
}
|
|
|
|
|
|
|