Commit 344ea43b authored by Tristan Olive's avatar Tristan Olive

Fixed delete team function

The remove team link was not working, as it required that all team members be removed first. Fixed so that all but one member must be removed, as that one member must remain in order for the team to be removed! Also, remove the user from the team when removing the team.

(DBOINCP-183)
parent 7fd2840e
......@@ -182,7 +182,10 @@ function boincteam_assume_foundership($team_id) {
function boincteam_delete($team_id) {
$team = node_load($team_id);
$boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE);
if ($boincteam->nusers == 0) {
if ($boincteam->nusers == 1) {
require_boinc('team');
$boincuser = boincuser_load();
user_quit_team($boincuser);
$boincteam->delete();
node_unpublish_action($team);
$team->uid = 0;
......
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