From dd075e4bbc50371ae799059efa2356710d38aafb Mon Sep 17 00:00:00 2001 From: Stanislav Atanasov Date: Fri, 13 Jun 2014 23:58:22 +0300 Subject: [PATCH] [ticket/12701] Add events to user_add function Add two new events to user_add function in ./includes/functions_user.php. core.user_add_before - allow modification of submitted to function data. Returns: @var array $user_row - user_row array - User array @var array $cp_data - cp_data array - CPF array core.user_add_after - return user_id, user_row and cp_data after user registration Returns: @var int $user_id - user_id of the new user @var array $user_row - user_row array - User array @var array $cp_data - cp_data array - CPF array Justification: Allow extensions to parse data before and after creation of the user. PHPBB3-12701 --- phpBB/includes/functions_user.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) mode change 100644 => 100755 phpBB/includes/functions_user.php diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php old mode 100644 new mode 100755 index 5a10f9f411..0990eacc1c --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -180,6 +180,17 @@ function user_add($user_row, $cp_data = false) return false; } + /** + * Event to parse/modify data submited to user_add function + * + * @event core.user_add_before + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add + * @since 3.1.0-b5 + */ + $vars = array('user_row', 'cp_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_before', compact($vars))); + $sql_ary = array( 'username' => $user_row['username'], 'username_clean' => $username_clean, @@ -344,6 +355,18 @@ function user_add($user_row, $cp_data = false) set_config('newest_user_colour', $row['group_colour'], true); } + /** + * Event that returns user id, user detals and user CPF of newly registared user + * + * @event core.user_add_after + * @var int user_id User id of newly registared user + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'user_row', 'cp_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_after', compact($vars))); + return $user_id; }