Commit 78d54291 authored by Robert Lyon's avatar Robert Lyon

Delete button on User's Settings page for 'no institution'

Bug 1480038 - When the registerallowed is turned off - this is wrong

Change-Id: Ib511a1c372a15cddd9fd7329cfa93cc72dac412f
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 68b62299
......@@ -1214,9 +1214,16 @@ class User {
// Users who belong to an institution that doesn't allow
// registration cannot delete themselves.
foreach ($this->get('institutions') as $i) {
if (!$i->registerallowed) {
return false;
$institutions = $this->get('institutions');
if (empty($institutions)) {
// only in the no institution
return get_field('institution', 'registerallowed', 'name', 'mahara');
}
else {
foreach ($institutions as $i) {
if (!$i->registerallowed) {
return false;
}
}
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment