From 37ceb57d12b936d810da645b6eb49aa2b1d12a5e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 26 Jul 2013 18:27:47 -0700 Subject: [ticket/11747] Add $phpbb_dispatcher to global PHPBB3-11747 --- phpBB/includes/ucp/ucp_prefs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index f24578da84..73b01deb22 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -26,7 +26,7 @@ class ucp_prefs function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx; $submit = (isset($_POST['submit'])) ? true : false; $error = $data = array(); -- cgit v1.2.1 From 79cd86bcbcfb2bf0f27d06fc475ea967ea38755b Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 26 Jul 2013 18:29:06 -0700 Subject: [ticket/11747] ucp_prefs_personal core events PHPBB3-11747 --- phpBB/includes/ucp/ucp_prefs.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 73b01deb22..8a92f22bba 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -55,6 +55,20 @@ class ucp_prefs $data['notifymethod'] = NOTIFY_BOTH; } + /** + * Add UCP edit global settings data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_prefs_personal_data + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp options data + * @since 3.1-A1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars))); + if ($submit) { if ($config['override_user_style']) @@ -93,6 +107,17 @@ class ucp_prefs 'user_style' => $data['style'], ); + /** + * Update UCP edit global settings data on form submit + * + * @event core.ucp_prefs_personal_update_data + * @var array data Submitted display options data + * @var array sql_ary Display options data we udpate + * @since 3.1-A1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_update_data', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; -- cgit v1.2.1 From d3859aa87427a75cb7c9f7645de3317a834b00ee Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 26 Jul 2013 18:31:58 -0700 Subject: [ticket/11747] ucp_prefs_view core events PHPBB3-11747 --- phpBB/includes/ucp/ucp_prefs.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 8a92f22bba..31cf5a4447 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -234,6 +234,20 @@ class ucp_prefs 'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')), ); + /** + * Add UCP edit display options data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_prefs_view_data + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp options data + * @since 3.1-A1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_data', compact($vars))); + if ($submit) { $error = validate_data($data, array( @@ -272,6 +286,17 @@ class ucp_prefs 'user_post_show_days' => $data['post_st'], ); + /** + * Update UCP edit display options data on form submit + * + * @event core.ucp_prefs_view_update_data + * @var array data Submitted display options data + * @var array sql_ary Display options data we udpate + * @since 3.1-A1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_update_data', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; -- cgit v1.2.1 From 01e133f3563181e163aa0fc85e89a6fc35d31c0f Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 26 Jul 2013 18:33:27 -0700 Subject: [ticket/11747] ucp_prefs_post core events PHPBB3-11747 --- phpBB/includes/ucp/ucp_prefs.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 31cf5a4447..e80cc2dce3 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -385,6 +385,20 @@ class ucp_prefs ); add_form_key('ucp_prefs_post'); + /** + * Add UCP edit posting defaults data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_prefs_post_data + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp options data + * @since 3.1-A1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_data', compact($vars))); + if ($submit) { if (check_form_key('ucp_prefs_post')) @@ -398,6 +412,17 @@ class ucp_prefs 'user_notify' => $data['notify'], ); + /** + * Update UCP edit posting defaults data on form submit + * + * @event core.ucp_prefs_post_update_data + * @var array data Submitted display options data + * @var array sql_ary Display options data we udpate + * @since 3.1-A1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_update_data', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; -- cgit v1.2.1