aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/useradd.php3
-rw-r--r--engine/lib/users.php4
2 files changed, 5 insertions, 2 deletions
diff --git a/actions/useradd.php b/actions/useradd.php
index e6e071f01..6d9ca1d2d 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -13,7 +13,7 @@
require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
- admin_gatekeeper(); // Only admins can make someone an admin
+ admin_gatekeeper(); // Only admins can add a user
action_gatekeeper();
// Get variables
@@ -41,6 +41,7 @@
$new_user->admin = 'yes';
$new_user->admin_created = true;
+ $new_user->created_by_guid = get_loggedin_userid();
notify_user($new_user->guid, $CONFIG->site->guid, elgg_echo('useradd:subject'), sprintf(elgg_echo('useradd:body'), $name, $CONFIG->site->name, $CONFIG->site->url, $username, $password));
diff --git a/engine/lib/users.php b/engine/lib/users.php
index cddc89b3a..04e95c964 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1249,7 +1249,9 @@
$user->name = $name;
$user->access_id = ACCESS_PUBLIC;
$user->salt = generate_random_cleartext_password(); // Note salt generated before password!
- $user->password = generate_user_password($user, $password);
+ $user->password = generate_user_password($user, $password);
+ $user->owner_guid = 0; // Users aren't owned by anyone, even if they are admin created.
+ $user->container_guid = 0; // Users aren't contained by anyone, even if they are admin created.
$user->save();
// If $friend_guid has been set, make mutual friends