Skip to content

Commit

Permalink
fixed: unable to edit a group as a normal user when limiting group
Browse files Browse the repository at this point in the history
creation (thanks to buraddo http://community.elgg.org/profile/buraddo)
  • Loading branch information
jeabakker committed Sep 28, 2012
1 parent 4103d70 commit 5b0e865
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ x.x:

- added: filter groups based on a tag field in index_group widget
- fixed: problem with group invite autocomplete on subfolder Elgg installations (thanks to Bruno Grossmann http://community.elgg.org/profile/bruno)
- fixed: unable to edit a group as a normal user when limiting group creation (thanks to buraddo http://community.elgg.org/profile/buraddo)
- changed: group invitations (and add) no always goto mail
- changed: some logic when (re)inviting for better system messages to the users
- changed: discussion dasboard widget ordering to be inline with default Elgg
Expand Down
16 changes: 16 additions & 0 deletions lib/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,20 @@ function group_tools_access_write_handler($hook, $type, $return_value, $params){

return $result;
}

function group_tools_action_handler($hook, $type, $return_value, $params){
$result = $return_value;

if($type == "groups/edit"){
// group creation can be limited, but editing isn't
if(group_tools_is_group_creation_limited()){
if(!get_input("group_guid") && !elgg_is_admin_logged_in()){
// trying to create a group, but you're not an admin
$result = false;
}
}
}

return $result;
}

4 changes: 1 addition & 3 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ function group_tools_init(){
}

// group creation can be limited to admins
if(!elgg_is_admin_logged_in() && group_tools_is_group_creation_limited()){
elgg_unregister_action("groups/edit");
}
elgg_register_plugin_hook_handler("action", "groups/edit", "group_tools_action_handler");

// register index widget to show latest discussions
elgg_register_widget_type("discussion", elgg_echo("discussion:latest"), elgg_echo("widgets:discussion:description"), "index,dashboard", true);
Expand Down

0 comments on commit 5b0e865

Please sign in to comment.