aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-24 11:37:03 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-24 11:37:03 +0000
commit947d6715e058a04cee1532cc2d11d0dee0e645c6 (patch)
treef9869db242d0e142611155bd2ebacbd82298a387 /engine/lib/users.php
parent6aa583f43da02138b0e8f26390e08b6a0d9e2ece (diff)
downloadelgg-947d6715e058a04cee1532cc2d11d0dee0e645c6.tar.gz
elgg-947d6715e058a04cee1532cc2d11d0dee0e645c6.tar.bz2
Added the ability to add a user to a user's friends list on registration.
git-svn-id: https://code.elgg.org/elgg/trunk@2305 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-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);