diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-01 14:20:55 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-01 14:20:55 +0000 |
commit | 9391179df8ba6ed1595de7de533f633d99d57b35 (patch) | |
tree | e2ddcf5ac254a5a37a6722e9e7eeb8f2fc67367b /engine/lib/users.php | |
parent | b1486d73ab4996931afa0d37fa9e5d09a4a88765 (diff) | |
download | elgg-9391179df8ba6ed1595de7de533f633d99d57b35.tar.gz elgg-9391179df8ba6ed1595de7de533f633d99d57b35.tar.bz2 |
User registration gubbins
git-svn-id: https://code.elgg.org/elgg/trunk@308 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r-- | engine/lib/users.php | 32 |
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 |