diff -r 35986c6b2150 -r bd3ee7f12bc1 plugins/SpecialGroups.php --- a/plugins/SpecialGroups.php Thu Jul 29 11:53:15 2010 -0400 +++ b/plugins/SpecialGroups.php Thu Jul 29 12:25:14 2010 -0400 @@ -294,15 +294,34 @@ $r = $db->fetchrow(); $members[] = $r; $db->free_result(); + $is_member = true; } - - if ( isset($_GET['act']) && $_GET['act'] == 'update' && !$is_member && $row['group_type'] == GROUP_REQUEST && !$is_pending && !$can_do_admin_stuff ) + else if ( isset($_GET['act']) && $_GET['act'] == 'update' && $is_member && ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_REQUEST) && !$can_do_admin_stuff ) + { + $q = $db->sql_query('DELETE FROM ' . table_prefix . "group_members WHERE group_id = $gid AND user_id = $session->user_id;"); + if ( !$q ) + $db->_die(); + + foreach ( $members as $i => $m ) + { + if ( $m['user_id'] == $session->user_id ) + { + unset($members[$i]); + break; + } + } + + echo '