diff options
Diffstat (limited to 'mod')
| -rw-r--r-- | mod/groups/actions/groups/edit.php | 43 | ||||
| -rw-r--r-- | mod/groups/languages/en.php | 1 | ||||
| -rw-r--r-- | mod/groups/views/default/forms/groups/edit.php | 24 | 
3 files changed, 37 insertions, 31 deletions
| diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php index b3c39c461..331c80be0 100644 --- a/mod/groups/actions/groups/edit.php +++ b/mod/groups/actions/groups/edit.php @@ -60,23 +60,6 @@ if (!$group->name) {  	forward(REFERER);  } -// Group membership - should these be treated with same constants as access permissions? -switch (get_input('membership')) { -	case ACCESS_PUBLIC: -		$group->membership = ACCESS_PUBLIC; -		break; -	default: -		$group->membership = ACCESS_PRIVATE; -} - -// Set access - all groups are public from elgg's point of view, unless the override is in place -if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { -	$visibility = (int)get_input('vis', '', false); - -	$group->access_id = $visibility; -} else { -	$group->access_id = ACCESS_PUBLIC; -}  // Set group tool options  if (isset($CONFIG->group_tool_options)) { @@ -89,7 +72,20 @@ if (isset($CONFIG->group_tool_options)) {  		}  		$group->$group_option_toggle_name = get_input($group_option_toggle_name, $group_option_default_value);  	} -}	 +} + +// Group membership - should these be treated with same constants as access permissions? +switch (get_input('membership')) { +	case ACCESS_PUBLIC: +		$group->membership = ACCESS_PUBLIC; +		break; +	default: +		$group->membership = ACCESS_PRIVATE; +} + +if ($new_group_flag) { +	$group->access_id = ACCESS_PUBLIC; +}  $group->save(); @@ -100,7 +96,18 @@ if ($new_group_flag) {  	add_to_river('river/group/create', 'create', $user->guid, $group->guid);  } +// Invisible group support +if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { +	$visibility = (int)get_input('vis', '', false); +	if ($visibility != ACCESS_PUBLIC || $visibility != ACCESS_LOGGED_IN) { +		$visibility = $group->group_acl; +	} +	if ($group->access_id != $visibility) { +		$group->access_id = $visibility; +		$group->save(); +	} +}  // Now see if we have a file icon  if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) { diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 91f9f0cb6..b798dbf2d 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -87,6 +87,7 @@ $english = array(  	 */  	'groups:access:private' => 'Closed - Users must be invited',  	'groups:access:public' => 'Open - Any user may join', +	'groups:access:group' => 'Group members only',  	'groups:closedgroup' => 'This group has a closed membership.',  	'groups:closedgroup:request' => 'To ask to be added, click the "request membership" menu link.',  	'groups:visibility' => 'Who can see this group?', diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 3993e750d..8b5a3c33e 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -8,8 +8,14 @@  // new groups default to open membership  if (isset($vars['entity'])) {  	$membership = $vars['entity']->membership; +	$access = $vars['entity']->access_id; +	if ($access != ACCESS_PUBLIC || ACCESS_LOGGED_IN) { +		// group only - this is done to handle access not created when group is created +		$access = ACCESS_PRIVATE; +	}  } else {  	$membership = ACCESS_PUBLIC; +	$access = ACCESS_PUBLIC;  }  ?> @@ -52,7 +58,7 @@ if ($group_profile_fields > 0) {  		<?php echo elgg_view('input/access', array(  			'name' => 'membership',  			'value' => $membership, -			'options' => array( +			'options_values' => array(  				ACCESS_PRIVATE => elgg_echo('groups:access:private'),  				ACCESS_PUBLIC => elgg_echo('groups:access:public')  			) @@ -68,19 +74,11 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {  	if (!$this_owner) {  		$this_owner = elgg_get_logged_in_user_guid();  	} -	$access = array( -		ACCESS_FRIENDS => elgg_echo("access:friends:label"), +	$access_options = array( +		ACCESS_PRIVATE => elgg_echo('groups:access:group'),  		ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),  		ACCESS_PUBLIC => elgg_echo("PUBLIC")  	); -	$collections = get_user_access_collections($vars['entity']->guid); -	if (is_array($collections)) { -		foreach ($collections as $c) { -			$access[$c->id] = $c->name; -		} -	} - -	$current_access = $vars['entity']->access_id ? $vars['entity']->access_id : ACCESS_PUBLIC;  ?>  <div> @@ -88,8 +86,8 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {  			<?php echo elgg_echo('groups:visibility'); ?><br />  			<?php echo elgg_view('input/access', array(  				'name' => 'vis', -				'value' =>  $current_access, -				'options' => $access, +				'value' =>  $access, +				'options_values' => $access_options,  			));  			?>  	</label> | 
