# HG changeset patch # User Dan # Date 1280420714 14400 # Node ID bd3ee7f12bc1497341c363be5d39460b03a36969 # Parent 35986c6b2150547ee4889601b5d95d00cf70d6bc Some fixes to autofill with Unicode usernames; fixed a few end user experience pieces of the group CP. Users are now allowed to freely leave GROUP_OPEN and GROUP_REQUEST groups, and must be removed by a group mod for GROUP_CLOSED and GROUP_HIDDEN. diff -r 35986c6b2150 -r bd3ee7f12bc1 language/english/user.json --- a/language/english/user.json Thu Jul 29 11:53:15 2010 -0400 +++ b/language/english/user.json Thu Jul 29 12:25:14 2010 -0400 @@ -419,10 +419,12 @@ msg_user_already_in: 'The user "%username%" is already in this group.', msg_user_added: 'The user "%username%" has been added to this usergroup.', msg_self_added: 'You have been added to this group.', + msg_self_removed: 'You have removed yourself from this group.', btn_view: 'View information', btn_request_join: 'Request membership', btn_join: 'Join this group', + btn_leave: 'Leave this group', btn_approve_pending: 'Approve membership', btn_reject_pending: 'Reject membership', btn_remove_selected: 'Remove selected users', 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 '