aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/users.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index da7040039..4f6a73626 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1058,9 +1058,10 @@
* @param string $name The user's display name
* @param string $email Their email address
* @param bool $allow_multiple_emails Allow the same email address to be registered multiple times?
+ * @param int $friend_guid Optionally, GUID of a user this user will friend once fully registered
* @return int|false The new user's GUID; false on failure
*/
- function register_user($username, $password, $name, $email, $allow_multiple_emails = false) {
+ function register_user($username, $password, $name, $email, $allow_multiple_emails = false, $friend_guid = 0) {
// Load the configuration
global $CONFIG;
@@ -1119,6 +1120,13 @@
$user->password = generate_user_password($user, $password);
$user->save();
+ // If $friend_guid has been set
+ if ($friend_guid) {
+ if ($friend_user = get_user($friend_guid)) {
+ $user->addFriend($friend_guid);
+ }
+ }
+
if (!$admin) {
$user->admin = true;
datalist_set('admin_registered',1);