diff --git a/actions/profile_widgets.php b/actions/profile_widgets.php new file mode 100644 index 00000000..ac75f29e --- /dev/null +++ b/actions/profile_widgets.php @@ -0,0 +1,28 @@ +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); \ No newline at end of file diff --git a/languages/en.php b/languages/en.php index f0bc31dc..4f262105 100644 --- a/languages/en.php +++ b/languages/en.php @@ -100,6 +100,11 @@ 'group_tools:multiple_admin:group_tool_option' => "Enable group admins to assign other group admins", + // group profile widgets + 'group_tools:profile_widgets:title' => "Show group profile widgets to non members", + 'group_tools:profile_widgets:description' => "This is a closed group. Default no widgets are shown to non members. Here you can configure if you whish to change that.", + 'group_tools:profile_widgets:option' => "Allow non members to view widgets on the group profile page:", + // group kick 'group_tools:group_kick:profile_actions:kick' => "Kick from group", @@ -157,6 +162,8 @@ 'group_tools:action:error:entities' => "The given GUIDs didn't result in the correct entities", 'group_tools:action:error:entity' => "The given GUID didn't result in a correct entity", 'group_tools:action:error:edit' => "You don't have access to the given entity", + 'group_tools:action:error:save' => "There was an error while saving the settings", + 'group_tools:action:success' => "The settings where saved successfully", // admin transfer - action 'group_tools:action:admin_transfer:error:access' => "You're not allowed to transfer ownership of this group", diff --git a/languages/nl.php b/languages/nl.php index a419f518..47a71124 100644 --- a/languages/nl.php +++ b/languages/nl.php @@ -1,5 +1,10 @@ 'Toon groep widgets aan niet leden', + 'group_tools:profile_widgets:description' => 'Dit is een besloten groep. Standaard worden er geen widgets getoond aan niet leden. Hier kan kan je deze instelling aanpassen', + 'group_tools:profile_widgets:option' => 'Mogen niet leden de widgets zien op de groep profiel pagina:', + 'group_tools:action:error:save' => 'Er is een fout opgetreden tijdens het opslaan van de instellingen', + 'group_tools:action:success' => 'De instellingen zijn succesvol opgeslagen', 'group_tools:groups:sorting:open' => 'Open', 'group_tools:groups:sorting:closed' => 'Besloten', 'widgets:group_river_widget:view:noactivity' => 'Geen activiteit gevonden.', diff --git a/manifest.xml b/manifest.xml index 9b461c46..30e8e155 100644 --- a/manifest.xml +++ b/manifest.xml @@ -66,6 +66,7 @@ ToDo Version History ==================== x.x: + - added: option for group admins to show group widgets to non members in case of a closed group - changed: activity filter in group river widget (now more advanced) - changed: group status (open/closed) CSS diff --git a/start.php b/start.php index 0e93c8e8..398e4c79 100644 --- a/start.php +++ b/start.php @@ -56,6 +56,9 @@ function group_tools_init(){ // show group edit as tabbed elgg_extend_view("forms/groups/edit", "group_tools/group_edit_tabbed", 1); + // show group profile widgets - edit form + elgg_extend_view("forms/groups/edit", "group_tools/forms/profile_widgets", 400); + // show group status in owner block elgg_extend_view("owner_block/extend", "group_tools/owner_block"); // show group status in stats (on group profile) @@ -175,8 +178,10 @@ function group_tools_version_1_3(){ register_action("group_tools/toggle_admin", false, dirname(__FILE__) . "/actions/toggle_admin.php"); register_action("group_tools/kick", false, dirname(__FILE__) . "/actions/kick.php"); register_action("group_tools/mail", false, dirname(__FILE__) . "/actions/mail.php"); + register_action("group_tools/profile_widgets", false, dirname(__FILE__) . "/actions/profile_widgets.php"); + register_action("group_tools/toggle_auto_join", false, dirname(__FILE__) . "/actions/toggle_auto_join.php", true); register_action("group_tools/fix_auto_join", false, dirname(__FILE__) . "/actions/fix_auto_join.php", true); - register_action("groups/email_invitation", false, dirname(__FILE__) . "/actions/groups/email_invitation.php"); + register_action("groups/email_invitation", false, dirname(__FILE__) . "/actions/groups/email_invitation.php"); \ No newline at end of file diff --git a/views/default/group_tools/forms/profile_widgets.php b/views/default/group_tools/forms/profile_widgets.php new file mode 100644 index 00000000..d704149e --- /dev/null +++ b/views/default/group_tools/forms/profile_widgets.php @@ -0,0 +1,34 @@ +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 = "

" . elgg_echo("group_tools:profile_widgets:title") . "

"; + $form_body .= "
" . elgg_echo("group_tools:profile_widgets:description") . "
"; + + $form_body .= "
"; + + $form_body .= "
"; + $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 .= "
"; + + $form_body .= "
"; + $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 .= "
"; + + $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)); + } + } \ No newline at end of file diff --git a/views/default/groups/closedmembership.php b/views/default/groups/closedmembership.php new file mode 100644 index 00000000..8c89e000 --- /dev/null +++ b/views/default/groups/closedmembership.php @@ -0,0 +1,27 @@ + +
+

+ +

+
+ +membership != ACCESS_PUBLIC) && ($group->profile_widgets == yes)){ + echo elgg_view("groups/profileitems", $vars); + } + } \ No newline at end of file