Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing roles from Emily #879 #880

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions modules/custom/cu_users/cu_users.install
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,6 @@ function cu_users_update_7019() {
));
}

/**
* Add Emily as an administrator.
*/
function cu_users_update_7020() {
// If new user does not exist.
$new_account = user_load_by_name('mortone');
if (!isset($new_account->uid)) {
// Create new user.
$account = new stdClass();
$account->name = 'mortone';
$account->mail = 'Emily.Kellagher@Colorado.EDU';
$account->status = 1;
$account = user_save($account);

$admin_role = user_role_load_by_name('administrator');
$query = db_insert('users_roles')->fields(array('uid', 'rid'));
$query->values(array('uid' => $account->uid, 'rid' => $admin_role->rid));
$query->execute();
}
}

/**
* Remove Erin Corson and Matt Tucker as a users
*/
Expand Down Expand Up @@ -486,3 +465,19 @@ function cu_users_update_7042() {
}
}
}

/**
* Remove roles from Emily
*/
function cu_users_update_7043() {
$users = array('mortone');
foreach ($users as $username) {
$user = user_load_by_name($username);
if ($user) {
foreach ($user->roles as $key => $role) {
unset($user->roles[$key]);
}
user_save($user);
}
}
}
1 change: 0 additions & 1 deletion modules/custom/cu_users/cu_users.module
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function cu_users_get_users($type = 'all') {
'brokaw' => 'Annie.Brokaw@Colorado.EDU',
'linebarg' => 'joanna.bertrand@Colorado.EDU',
'wetu1300' => 'wendy.turnbull@Colorado.EDU',
'mortone' => 'Emily.Kellagher@Colorado.EDU',
);

$user_array['site_owner'] = array(
Expand Down