mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[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
This commit is contained in:
parent
b41a730471
commit
dd075e4bbc
1 changed files with 23 additions and 0 deletions
23
phpBB/includes/functions_user.php
Normal file → Executable file
23
phpBB/includes/functions_user.php
Normal file → Executable file
|
@ -180,6 +180,17 @@ function user_add($user_row, $cp_data = false)
|
||||||
return 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(
|
$sql_ary = array(
|
||||||
'username' => $user_row['username'],
|
'username' => $user_row['username'],
|
||||||
'username_clean' => $username_clean,
|
'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);
|
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;
|
return $user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue