aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-09-05 11:36:25 -0700
committerNathan Guse <nathaniel.guse@gmail.com>2013-09-05 11:36:25 -0700
commitdd86e8d0ae0179cf50076cdb1a8020266b6432a5 (patch)
treed79c221d43fdbb6c482191e87cf2baeb026af4c2 /phpBB
parent9d5ab7615f1fe2fe33b6c09dc22c6e08884fb630 (diff)
parent9ea9afd1c431c8b6531adeac38b928f1ed6ba709 (diff)
downloadforums-dd86e8d0ae0179cf50076cdb1a8020266b6432a5.tar
forums-dd86e8d0ae0179cf50076cdb1a8020266b6432a5.tar.gz
forums-dd86e8d0ae0179cf50076cdb1a8020266b6432a5.tar.bz2
forums-dd86e8d0ae0179cf50076cdb1a8020266b6432a5.tar.xz
forums-dd86e8d0ae0179cf50076cdb1a8020266b6432a5.zip
Merge pull request #1618 from VSEphpbb/ticket/11747
[ticket/11747] UCP Prefs Core and Template Events
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/docs/events.md60
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php77
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_post.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_view.html4
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_post.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_view.html4
8 files changed, 152 insertions, 1 deletions
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index af6e6bdb1c..bef4727149 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -179,6 +179,66 @@ ucp_pm_viewmessage_print_head_append
* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html
* Purpose: Add asset calls directly before the `</head>` tag of the Print PM screen
+ucp_prefs_personal_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_personal.html
+ + styles/subsilver2/template/ucp_prefs_personal.html
+* Purpose: Add user options to the top of the Edit Global Settings block
+
+ucp_prefs_personal_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_personal.html
+ + styles/subsilver2/template/ucp_prefs_personal.html
+* Purpose: Add user options to the bottom of the Edit Global Settings block
+
+ucp_prefs_post_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_post.html
+ + styles/subsilver2/template/ucp_prefs_post.html
+* Purpose: Add user options to the top of the Edit Posting Defaults block
+
+ucp_prefs_post_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_post.html
+ + styles/subsilver2/template/ucp_prefs_post.html
+* Purpose: Add user options to the bottom of the Edit Posting Defaults block
+
+ucp_prefs_view_radio_buttons_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the top of the radio buttons block of the Edit
+Display Options screen
+
+ucp_prefs_view_radio_buttons_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the bottom of the radio buttons block of the Edit
+Display Options screen
+
+ucp_prefs_view_select_menu_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the top of the drop-down lists block of the Edit
+Display Options screen
+
+ucp_prefs_view_select_menu_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the bottom of the drop-down lists block of the Edit
+Display Options screen
+
viewtopic_print_head_append
===
* Location: styles/prosilver/template/viewtopic_print.html
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index f24578da84..e80cc2dce3 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();
@@ -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'];
@@ -209,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(
@@ -247,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'];
@@ -335,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'))
@@ -348,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'];
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
index 9a639786b7..8111496dcb 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
@@ -9,6 +9,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_personal_prepend -->
<dl>
<dt><label for="viewemail0">{L_SHOW_EMAIL}{L_COLON}</label></dt>
<dd>
@@ -71,6 +72,7 @@
</dd>
<dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd>
</dl>
+ <!-- EVENT ucp_prefs_personal_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_post.html b/phpBB/styles/prosilver/template/ucp_prefs_post.html
index 6c68b2bccc..891e49af6f 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_post.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_post.html
@@ -8,6 +8,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_post_prepend -->
<dl>
<dt><label for="bbcode1">{L_DEFAULT_BBCODE}{L_COLON}</label></dt>
<dd>
@@ -36,6 +37,7 @@
<label for="notify0"><input type="radio" name="notify" id="notify0" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
+ <!-- EVENT ucp_prefs_post_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_view.html b/phpBB/styles/prosilver/template/ucp_prefs_view.html
index 51561349c3..7f8d0a344c 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_view.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_view.html
@@ -9,6 +9,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_view_radio_buttons_prepend -->
<dl>
<dt><label for="images1">{L_VIEW_IMAGES}{L_COLON}</label></dt>
<dd>
@@ -53,7 +54,9 @@
</dd>
</dl>
<!-- ENDIF -->
+ <!-- EVENT ucp_prefs_view_radio_buttons_append -->
<hr />
+ <!-- EVENT ucp_prefs_view_select_menu_prepend -->
<dl>
<dt><label>{L_VIEW_TOPICS_DAYS}{L_COLON}</label></dt>
<dd>{S_TOPIC_SORT_DAYS}</dd>
@@ -79,6 +82,7 @@
<dt><label>{L_VIEW_POSTS_DIR}{L_COLON}</label></dt>
<dd>{S_POST_SORT_DIR}</dd>
</dl>
+ <!-- EVENT ucp_prefs_view_select_menu_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
index 8f6e345e69..cd5fc9a13f 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
@@ -29,6 +29,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_personal_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_SHOW_EMAIL}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="viewemail" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span>&nbsp;&nbsp;<input type="radio" class="radio" name="viewemail" value="0"<!-- IF not S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
@@ -75,6 +76,7 @@
<div id="custom_date"<!-- IF not S_CUSTOM_DATEFORMAT --> style="display:none;"<!-- ENDIF -->><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="post" style="margin-top: 3px;" /></div>
</td>
</tr>
+<!-- EVENT ucp_prefs_personal_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_post.html b/phpBB/styles/subsilver2/template/ucp_prefs_post.html
index 03f1472942..0a558b863c 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_post.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_post.html
@@ -9,6 +9,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_post_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_DEFAULT_BBCODE}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="bbcode" value="1"<!-- IF S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="bbcode" value="0"<!-- IF not S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
@@ -25,6 +26,7 @@
<td class="row1" width="50%"><b class="genmed">{L_DEFAULT_NOTIFY}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="notify" value="1"<!-- IF S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="notify" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
</tr>
+<!-- EVENT ucp_prefs_post_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_view.html b/phpBB/styles/subsilver2/template/ucp_prefs_view.html
index cc1b20a987..c10c458627 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_view.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_view.html
@@ -9,6 +9,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_view_radio_buttons_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_IMAGES}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="images" value="1"<!-- IF S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="images" value="0"<!-- IF not S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
@@ -35,9 +36,11 @@
<td class="row2"><input type="radio" class="radio" name="wordcensor" value="1"<!-- IF S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="wordcensor" value="0"<!-- IF not S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_view_radio_buttons_append -->
<tr>
<td colspan="2" class="spacer"></td>
</tr>
+<!-- EVENT ucp_prefs_view_select_menu_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DAYS}{L_COLON}</b></td>
<td class="row2">{S_TOPIC_SORT_DAYS}</td>
@@ -65,6 +68,7 @@
<td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DIR}{L_COLON}</b></td>
<td class="row2">{S_POST_SORT_DIR}</td>
</tr>
+<!-- EVENT ucp_prefs_view_select_menu_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>