-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: option for group admins to show group widgets to non members in
case of a closed group
- Loading branch information
Showing
7 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
gatekeeper(); | ||
|
||
$group_guid = (int) get_input("group_guid"); | ||
$profile_widgets = get_input("profile_widgets", "no"); | ||
|
||
$forward_url = REFERER; | ||
|
||
if(!empty($group_guid) && ($group = get_entity($group_guid))){ | ||
if(($group instanceof ElggGroup) && $group->canEdit()){ | ||
$group->profile_widgets = $profile_widgets; | ||
|
||
if($group->save()){ | ||
$forward_url = $group->getURL(); | ||
|
||
system_message(elgg_echo("group_tools:action:success")); | ||
} else { | ||
register_error(elgg_echo("group_tools:action:error:save")); | ||
} | ||
} else { | ||
register_error(elgg_echo("group_tools:action:error:entity")); | ||
} | ||
} else { | ||
register_error(elgg_echo("group_tools:action:error:input")); | ||
} | ||
|
||
forward($forward_url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
$group = $vars["entity"]; | ||
|
||
if(!empty($group) && ($group instanceof ElggGroup) && $group->canEdit()){ | ||
if($group->membership != ACCESS_PUBLIC){ | ||
// closed membership, so extend options | ||
$noyes_options = array( | ||
"no" => elgg_echo("option:no"), | ||
"yes" => elgg_echo("option:yes") | ||
); | ||
|
||
// build form | ||
$form_body = "<h3 class='settings'>" . elgg_echo("group_tools:profile_widgets:title") . "</h3>"; | ||
$form_body .= "<div>" . elgg_echo("group_tools:profile_widgets:description") . "</div>"; | ||
|
||
$form_body .= "<br />"; | ||
|
||
$form_body .= "<div>"; | ||
$form_body .= elgg_echo("group_tools:profile_widgets:option"); | ||
$form_body .= " " . elgg_view("input/pulldown", array("internalname" => "profile_widgets", "options_values" => $noyes_options, "value" => $group->profile_widgets)); | ||
$form_body .= "</div>"; | ||
|
||
$form_body .= "<div>"; | ||
$form_body .= elgg_view("input/hidden", array("internalname" => "group_guid", "value" => $group->getGUID())); | ||
$form_body .= elgg_view("input/submit", array("value" => elgg_echo("submit"))); | ||
$form_body .= "</div>"; | ||
|
||
$form = elgg_view("input/form", array("body" => $form_body, | ||
"action" => $vars["url"] . "action/group_tools/profile_widgets")); | ||
|
||
echo elgg_view("page_elements/contentwrapper", array("body" => $form)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* Elgg groups plugin full profile view (for a closed group you haven't joined). | ||
* | ||
* @package ElggGroups | ||
*/ | ||
|
||
$group = $vars["entity"]; | ||
|
||
?> | ||
<div id="groups_closed_membership"> | ||
<p> | ||
<?php | ||
echo elgg_echo('groups:closedgroup'); | ||
if (isloggedin()) { | ||
echo ' ' . elgg_echo('groups:closedgroup:request'); | ||
} | ||
?> | ||
</p> | ||
</div> | ||
|
||
<?php | ||
if(!empty($group) && ($group instanceof ElggGroup)){ | ||
if(($group->membership != ACCESS_PUBLIC) && ($group->profile_widgets == yes)){ | ||
echo elgg_view("groups/profileitems", $vars); | ||
} | ||
} |