aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/group.php12
-rw-r--r--mod/groups/actions/edit.php9
-rw-r--r--mod/groups/actions/join.php2
-rw-r--r--mod/groups/languages/en.php1
-rw-r--r--mod/groups/views/default/forms/groups/edit.php9
-rw-r--r--mod/groups/views/default/groups/menu/actions.php2
6 files changed, 32 insertions, 3 deletions
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 134206b02..5524461f5 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -148,6 +148,18 @@
}
/**
+ * Returns whether the current group is public membership or not.
+ * @return bool
+ */
+ public function isPublicMembership()
+ {
+ if ($this->membership == 2)
+ return true;
+
+ return false;
+ }
+
+ /**
* Return whether a given user is a member of this group or not.
*
* @param ElggUser $user The user
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php
index b5502115b..7965625e8 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/edit.php
@@ -54,6 +54,15 @@
exit;
}
+ // Group membership
+ switch (get_input('membership'))
+ {
+ case 0: $group->membership = 0;
+ case 1 :$group->membership = 1; break;
+ case 2:
+ default: $group->membership = 2;
+ }
+
// Get access
$group->access_id = get_input('access_id', 0);
diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php
index 77d2e3021..84e770065 100644
--- a/mod/groups/actions/join.php
+++ b/mod/groups/actions/join.php
@@ -26,7 +26,7 @@
if (($user instanceof ElggUser) && ($group instanceof ElggGroup))
{
- if ($group->access_id == 2)
+ if ($group->isPublicMembership())
{
if ($group->join($user))
{
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index af3213fbf..13ab1b041 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -28,6 +28,7 @@
'groups:interests' => 'Interests',
'groups:website' => 'Website',
'groups:membership' => "Membership",
+ 'groups:access' => "Access permissions",
'groups:owner' => "Owner",
'groups:noaccess' => 'No access to group',
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index abb226464..4fcaa80a3 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -47,7 +47,14 @@
<p>
<label>
<?php echo elgg_echo('groups:membership'); ?><br />
- <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id, 'options' => array( 0 => 'Private', 2=>'Public'))); ?>
+ <?php echo elgg_view('input/access', array('internalname' => 'membership','value' => $vars['entity']->membership, 'options' => array( 0 => 'Private', 2=>'Public'))); ?>
+ </label>
+ </p>
+
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $vars['entity']->access_id )); ?>
</label>
</p>
diff --git a/mod/groups/views/default/groups/menu/actions.php b/mod/groups/views/default/groups/menu/actions.php
index 8e1130871..4c27fea9b 100644
--- a/mod/groups/views/default/groups/menu/actions.php
+++ b/mod/groups/views/default/groups/menu/actions.php
@@ -17,7 +17,7 @@
}
else
{
- if ($vars['entity']->access_id == 2)
+ if ($vars['entity']->isPublicMembership())
{
?><p><a href="<?php echo $vars['url']; ?>action/groups/join?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:join"); ?></a></p><?php
}