aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index e8e6554f9..2c2465ced 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -457,4 +457,36 @@
return false;
}
+
+ function register_user(string $username, string $password, string $name, string $email) {
+
+ // Load the configuration
+ global $CONFIG;
+
+ // A little sanity checking
+ if (empty($username)
+ || empty($password)
+ || empty($name)
+ || empty($email))
+ return false;
+
+ // Check to see if $username exists already
+ if ($user = get_user_by_username($username)) {
+ return false;
+ }
+
+ // Otherwise ...
+ $user = new ElggUser();
+ $user->username = $username;
+ $user->password = md5($password);
+ $user->email = $email;
+ $user->name = $name;
+ return $user->save();
+
+ }
+
+ //register actions *************************************************************
+
+ register_action("register",true);
+
?> \ No newline at end of file