]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3364: Added action tokens and fixed guids for featuring/unfeaturing groups...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 20 Apr 2011 14:59:56 +0000 (14:59 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 20 Apr 2011 14:59:56 +0000 (14:59 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@9006 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/groups/actions/groups/featured.php
mod/groups/languages/en.php
mod/groups/start.php

index 2d623b1e4b12d84a74d5bef29b3fa23600e9bb54..4cb9f812250a35f7ffbbaf6cf8d73e96ca89d0c4 100644 (file)
@@ -10,17 +10,18 @@ $action = get_input('action_type');
 
 $group = get_entity($group_guid);
 
-if ($group) {
-       //get the action, is it to feature or unfeature
-       if ($action == "feature") {
-               $group->featured_group = "yes";
-               system_message(elgg_echo('groups:featuredon'));
-       }
+if (!elgg_instanceof($group, 'group')) {
+       register_error(elgg_echo('groups:featured_error'));
+       forward(REFERER);
+}
 
-       if ($action == "unfeature") {
-               $group->featured_group = "no";
-               system_message(elgg_echo('groups:unfeatured'));
-       }
+//get the action, is it to feature or unfeature
+if ($action == "feature") {
+       $group->featured_group = "yes";
+       system_message(elgg_echo('groups:featuredon', array($group->name)));
+} else {
+       $group->featured_group = "no";
+       system_message(elgg_echo('groups:unfeatured', array($group->name)));
 }
 
 forward(REFERER);
index dc65244fd6ca4590ffc8aa7768004ecd66eedb3a..63a6df3a99fd4578e2af80ccf5aea7e5e4424bd8 100644 (file)
@@ -45,8 +45,9 @@ $english = array(
        'groups:featured' => 'Featured groups',
        'groups:makeunfeatured' => 'Unfeature',
        'groups:makefeatured' => 'Make featured',
-       'groups:featuredon' => 'You have made this group a featured one.',
-       'groups:unfeatured' => 'You have removed this group from the featured list',
+       'groups:featuredon' => '%s is now a featured group.',
+       'groups:unfeatured' => '%s has been removed from the featured groups.',
+       'groups:featured_error' => 'Invalid group.',
        'groups:joinrequest' => 'Request membership',
        'groups:join' => 'Join group',
        'groups:leave' => 'Leave group',
index ee99ac9b47b3ae560f4c966e5365607775b7e5a4..9de7f1cc1bcbb96e693f9ba2187c6219b635d4d2 100644 (file)
@@ -346,11 +346,11 @@ function groups_entity_menu_setup($hook, $type, $return, $params) {
 
        // feature link
        if (elgg_is_admin_logged_in()) {
-               if ($group->featured_group == "yes") {
-                       $url = "action/groups/featured?group_guid={$group->guid}&action_type=unfeature";
+               if ($entity->featured_group == "yes") {
+                       $url = "action/groups/featured?group_guid={$entity->guid}&action_type=unfeature";
                        $wording = elgg_echo("groups:makeunfeatured");
                } else {
-                       $url = "action/groups/featured?group_guid={$group->guid}&action_type=feature";
+                       $url = "action/groups/featured?group_guid={$entity->guid}&action_type=feature";
                        $wording = elgg_echo("groups:makefeatured");
                }
                $options = array(
@@ -358,6 +358,7 @@ function groups_entity_menu_setup($hook, $type, $return, $params) {
                        'text' => $wording,
                        'href' => $url,
                        'priority' => 300,
+                       'is_action' => true
                );
                $return[] = ElggMenuItem::factory($options);
        }