mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12409] Add acp_users.php core events to modify users preferences data
This commit is contained in:
commit
69a14cf238
1 changed files with 65 additions and 25 deletions
|
@ -1501,6 +1501,17 @@ class acp_users
|
|||
'notify' => request_var('notify', $user_row['user_notify']),
|
||||
);
|
||||
|
||||
/**
|
||||
* Modify users preferences data
|
||||
*
|
||||
* @event core.acp_users_prefs_modify_data
|
||||
* @var array data Array with users preferences data
|
||||
* @var array user_row Array with user data
|
||||
* @since 3.1.0-b3
|
||||
*/
|
||||
$vars = array('data', 'user_row');
|
||||
extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_data', compact($vars)));
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$error = validate_data($data, array(
|
||||
|
@ -1557,6 +1568,21 @@ class acp_users
|
|||
'user_notify' => $data['notify'],
|
||||
);
|
||||
|
||||
/**
|
||||
* Modify SQL query before users preferences are updated
|
||||
*
|
||||
* @event core.acp_users_prefs_modify_sql
|
||||
* @var array data Array with users preferences data
|
||||
* @var array user_row Array with user data
|
||||
* @var array sql_ary SQL array with users preferences data to update
|
||||
* @var array error Array with errors data
|
||||
* @since 3.1.0-b3
|
||||
*/
|
||||
$vars = array('data', 'user_row', 'sql_ary', 'error');
|
||||
extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars)));
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE user_id = $user_id";
|
||||
|
@ -1589,6 +1615,7 @@ class acp_users
|
|||
|
||||
trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
|
||||
}
|
||||
}
|
||||
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = array_map(array($user, 'lang'), $error);
|
||||
|
@ -1651,7 +1678,7 @@ class acp_users
|
|||
}
|
||||
|
||||
$timezone_selects = phpbb_timezone_select($user, $data['tz'], true);
|
||||
$template->assign_vars(array(
|
||||
$user_prefs_data = array(
|
||||
'S_PREFS' => true,
|
||||
'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true,
|
||||
|
||||
|
@ -1691,9 +1718,22 @@ class acp_users
|
|||
'S_STYLE_OPTIONS' => style_select($data['style']),
|
||||
'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
|
||||
'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Modify users preferences data before assigning it to the template
|
||||
*
|
||||
* @event core.acp_users_prefs_modify_template_data
|
||||
* @var array data Array with users preferences data
|
||||
* @var array user_row Array with user data
|
||||
* @var array user_prefs_data Array with users preferences data to be assigned to the template
|
||||
* @since 3.1.0-b3
|
||||
*/
|
||||
$vars = array('data', 'user_row', 'user_prefs_data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars)));
|
||||
|
||||
$template->assign_vars($user_prefs_data);
|
||||
|
||||
break;
|
||||
|
||||
case 'avatar':
|
||||
|
|
Loading…
Add table
Reference in a new issue