[ticket/13675] Add validate to acp_profile event and add template events

for acp users profile

PHPBB3-13675
This commit is contained in:
Richard McGirr 2015-03-06 07:26:35 -05:00
parent 525a62f72e
commit 6b87e06292
3 changed files with 38 additions and 2 deletions

View file

@ -2,6 +2,7 @@
<fieldset> <fieldset>
<legend>{L_USER_PROFILE}</legend> <legend>{L_USER_PROFILE}</legend>
<!-- EVENT acp_users_profile_before -->
<dl> <dl>
<dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt> <dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt>
<dd><input type="email" id="jabber" name="jabber" value="{JABBER}" /></dd> <dd><input type="email" id="jabber" name="jabber" value="{JABBER}" /></dd>
@ -10,6 +11,7 @@
<dt><label for="birthday">{L_BIRTHDAY}{L_COLON}</label><br /><span>{L_BIRTHDAY_EXPLAIN}</span></dt> <dt><label for="birthday">{L_BIRTHDAY}{L_COLON}</label><br /><span>{L_BIRTHDAY_EXPLAIN}</span></dt>
<dd>{L_DAY}{L_COLON} <select id="birthday" name="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select> {L_MONTH}{L_COLON} <select name="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select> {L_YEAR}{L_COLON} <select name="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></dd> <dd>{L_DAY}{L_COLON} <select id="birthday" name="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select> {L_MONTH}{L_COLON} <select name="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select> {L_YEAR}{L_COLON} <select name="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></dd>
</dl> </dl>
<!-- EVENT acp_users_profile_after -->
</fieldset> </fieldset>
<!-- IF .profile_fields --> <!-- IF .profile_fields -->
@ -26,7 +28,7 @@
<!-- END profile_fields --> <!-- END profile_fields -->
</fieldset> </fieldset>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT acp_users_profile_custom_after -->
<fieldset class="quick"> <fieldset class="quick">
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
{S_FORM_TOKEN} {S_FORM_TOKEN}

View file

@ -177,6 +177,27 @@ acp_ranks_list_header_before
* Purpose: Add content after the last header-column (but before the action column) * Purpose: Add content after the last header-column (but before the action column)
in the ranks list in the ACP in the ranks list in the ACP
acp_users_profile_before
===
* Locations:
+ adm/style/acp_users_profile.html
* Since: 3.1.4-RC1
* Purpose: Add content before the profile details when editing a user in the ACP
acp_users_profile_after
===
* Locations:
+ adm/style/acp_users_profile.html
* Since: 3.1.4-RC1
* Purpose: Add content after the profile details but before the custom profile fields when editing a user in the ACP
acp_users_profile_custom_after
===
* Locations:
+ adm/style/acp_users_profile.html
* Since: 3.1.4-RC1
* Purpose: Add content after the the custom profile fields when editing a user in the ACP
acp_simple_footer_after acp_simple_footer_after
=== ===
* Location: adm/style/simple_footer.html * Location: adm/style/simple_footer.html

View file

@ -1414,6 +1414,18 @@ class acp_users
$error[] = 'FORM_INVALID'; $error[] = 'FORM_INVALID';
} }
/**
* Validate profile data in ACP before submitting to the database
*
* @event core.acp_users_profile_validate
* @var bool submit Flag indicating if submit button has been pressed
* @var array data Array with user profile data
* @var array error Array with the form errors
* @since 3.1.4-RC1
*/
$vars = array('submit', 'data', 'error');
extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars)));
if (!sizeof($error)) if (!sizeof($error))
{ {
$sql_ary = array( $sql_ary = array(
@ -1429,9 +1441,10 @@ class acp_users
* @var array data Array with user profile data * @var array data Array with user profile data
* @var int user_id The user id * @var int user_id The user id
* @var array user_row Array with the full user data * @var array user_row Array with the full user data
* @var array sql_ary Array with sql data
* @since 3.1.4-RC1 * @since 3.1.4-RC1
*/ */
$vars = array('cp_data', 'data', 'user_id', 'user_row'); $vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars)));
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'UPDATE ' . USERS_TABLE . '