mirror of https://github.com/BOINC/boinc.git
parent
fdd221e7a0
commit
d670551ab3
|
@ -1223,28 +1223,34 @@ function boincuser_control($uid = NULL, $action = NULL) {
|
||||||
}
|
}
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'ban':
|
case 'ban':
|
||||||
$penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
|
if (user_access('assign community member role')
|
||||||
$boincuser_record = array(
|
OR user_access('assign all roles')) {
|
||||||
'uid' => $uid,
|
$penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
|
||||||
'penalty_expiration' => time() + $penalty_period,
|
$boincuser_record = array(
|
||||||
);
|
'uid' => $uid,
|
||||||
drupal_write_record('boincuser', $boincuser_record, 'uid');
|
'penalty_expiration' => time() + $penalty_period,
|
||||||
$community_role = array_search('community member', user_roles(true));
|
);
|
||||||
if (isset($account->roles[$community_role])) {
|
drupal_write_record('boincuser', $boincuser_record, 'uid');
|
||||||
unset($account->roles[$community_role]);
|
$community_role = array_search('community member', user_roles(true));
|
||||||
user_save($account, array('roles' => $account->roles));
|
if (isset($account->roles[$community_role])) {
|
||||||
|
unset($account->roles[$community_role]);
|
||||||
|
user_save($account, array('roles' => $account->roles));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'lift-ban':
|
case 'lift-ban':
|
||||||
$boincuser_record = array(
|
if (user_access('assign community member role')
|
||||||
'uid' => $uid,
|
OR user_access('assign all roles')) {
|
||||||
'penalty_expiration' => 0,
|
$boincuser_record = array(
|
||||||
);
|
'uid' => $uid,
|
||||||
drupal_write_record('boincuser', $boincuser_record, 'uid');
|
'penalty_expiration' => 0,
|
||||||
$community_role = array_search('community member', user_roles(true));
|
);
|
||||||
if (!isset($account->roles[$community_role])) {
|
drupal_write_record('boincuser', $boincuser_record, 'uid');
|
||||||
$account->roles[$community_role] = 'community member';
|
$community_role = array_search('community member', user_roles(true));
|
||||||
user_save($account, array('roles' => $account->roles));
|
if (!isset($account->roles[$community_role])) {
|
||||||
|
$account->roles[$community_role] = 'community member';
|
||||||
|
user_save($account, array('roles' => $account->roles));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue