aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
commit36ef345eb6425106f061fb866d9fa66d051e16df (patch)
tree53fb2bd05f8b5e2010f9e3d1e93075ad7071ec1e /actions
parent5571ca5b350fd1735f13af7ddfbb88afa6befb0c (diff)
downloadelgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.gz
elgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.bz2
Merged 5530:5604 from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions')
-rw-r--r--actions/admin/user/makeadmin.php7
-rw-r--r--actions/admin/user/removeadmin.php7
-rw-r--r--actions/register.php4
-rw-r--r--actions/useradd.php7
4 files changed, 11 insertions, 14 deletions
diff --git a/actions/admin/user/makeadmin.php b/actions/admin/user/makeadmin.php
index 580e7df05..dc5c508fb 100644
--- a/actions/admin/user/makeadmin.php
+++ b/actions/admin/user/makeadmin.php
@@ -15,11 +15,10 @@ admin_gatekeeper();
// Get the user
$guid = get_input('guid');
-$obj = get_entity($guid);
+$user = get_entity($guid);
-if (($obj instanceof ElggUser) && ($obj->canEdit())) {
- $obj->admin = 'yes';
- if ($obj->admin) {
+if (($user instanceof ElggUser) && ($user->canEdit())) {
+ if ($user->makeAdmin()) {
system_message(elgg_echo('admin:user:makeadmin:yes'));
} else {
register_error(elgg_echo('admin:user:makeadmin:no'));
diff --git a/actions/admin/user/removeadmin.php b/actions/admin/user/removeadmin.php
index 445596331..b5872e592 100644
--- a/actions/admin/user/removeadmin.php
+++ b/actions/admin/user/removeadmin.php
@@ -15,11 +15,10 @@ admin_gatekeeper();
// Get the user
$guid = get_input('guid');
-$obj = get_entity($guid);
+$user = get_entity($guid);
-if (($obj instanceof ElggUser) && ($obj->canEdit())) {
- $obj->admin = '';
- if (!$obj->admin) {
+if (($user instanceof ElggUser) && ($user->canEdit())) {
+ if ($user->removeAdmin()) {
system_message(elgg_echo('admin:user:removeadmin:yes'));
} else {
register_error(elgg_echo('admin:user:removeadmin:no'));
diff --git a/actions/register.php b/actions/register.php
index c515d27ee..efbc3def3 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -33,7 +33,7 @@ if (!$CONFIG->disable_registration) {
if (($guid) && ($admin)) {
// Only admins can make someone an admin
admin_gatekeeper();
- $new_user->admin = 'yes';
+ $new_user->makeAdmin();
}
// Send user validation request on register only
@@ -42,7 +42,7 @@ if (!$CONFIG->disable_registration) {
request_user_validation($guid);
}
- if (!$new_user->admin) {
+ if (!$new_user->isAdmin()) {
// Now disable if not an admin
// Don't do a recursive disable. Any entities owned by the user at this point
// are products of plugins that hook into create user and might need
diff --git a/actions/useradd.php b/actions/useradd.php
index 71fc3cd63..e92845cbb 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -25,15 +25,15 @@ if (is_array($admin)) {
// For now, just try and register the user
try {
- $guid = register_user($username, $password, $name, $email, true);
+ $guid = register_user($username, $password, $name, $email, TRUE);
if (((trim($password) != "") && (strcmp($password, $password2)==0)) && ($guid)) {
$new_user = get_entity($guid);
if (($guid) && ($admin)) {
- $new_user->admin = 'yes';
+ $new_user->makeAdmin();
}
- $new_user->admin_created = true;
+ $new_user->admin_created = TRUE;
$new_user->created_by_guid = get_loggedin_userid();
set_user_validation_status($new_user->getGUID(), TRUE, 'admin_created');
@@ -48,4 +48,3 @@ try {
}
forward($_SERVER['HTTP_REFERER']);
-exit;