diff --git a/schoolstudents.php b/schoolstudents.php index 0c0dd12..1d7056e 100644 --- a/schoolstudents.php +++ b/schoolstudents.php @@ -146,6 +146,10 @@ function user_row($uid, $username, $firstName, $lastName, $email){ // delete the record for the specified user id. Returns true on succes, error message on failure function delete_record($uid){ + // delete schedule registrations + mysql_query("DELETE FROM schedule_registrations_users_link WHERE users_uid = $uid"); + + // now delete the user $user = user_load_by_uid($uid); user_delete($user); $user = user_load_by_uid($uid); @@ -153,6 +157,7 @@ function delete_record($uid){ if($user['deleted'] != 'yes'){ return "Failed to delete user"; } + return true; } diff --git a/schoolteams.php b/schoolteams.php index b41a474..9498456 100644 --- a/schoolteams.php +++ b/schoolteams.php @@ -107,7 +107,19 @@ function draw_page(){ echo i18n('name') . ': '; echo '
'; echo "'; - echo "'; + $record = mysql_fetch_array(mysql_query("SELECT count(*) AS regCount FROM schedule_registrations WHERE so_teams_id = " . $team['id'])); + if($record['regCount'] == 0){ + echo "'; + }else{ + echo '
'; + echo ''; + if($record['regCount'] > 1){ + echo i18n("This team is currently registered for %1 events and can not be deleted.", array($record['regCount'])); + }else{ + echo i18n("This team is currently registered for an event and can not be deleted."); + } + echo '
'; + } echo ""; echo ''; echo "";