Fix group membership access

You'll definately work it out by reading this, but I'm very new to php and elgg!

When creating/editing a group I would like to get rid of the little drop down box that gives you the option of making your group closed/open and just set it to open as default. I've searched the documentation and these discussions and not found anything that specifically helps me do that.

So far, I've commented out lines 59-72 of mod/groups/views/default/forms/groups/edit.php and I thought this would work as default permissions on my site are public. But the group is created as private.

I'd really appreciate any help!


  • I worked it out in myself the end. The action file assumes that PRIVATE is the default if the form is never submitted. I changed the block of code at around line 90 of mod/groups/actions/groups/edit.php to just set the access to public with $group->membership = ACCESS_PUBLIC;

  • In addition to commenting out these drop down box lines of code in mod/groups/views/default/forms/groups/edit.php, you should also comment out the code block below in mod/groups/actions/groups/edit.php:

    // Group membership - should these be treated with same constants as access permissions?
    switch (get_input('membership')) {
        case ACCESS_PUBLIC:
            $group->membership = ACCESS_PUBLIC;
            $group->membership = ACCESS_PRIVATE;

    and insert the following line of code immediately after that above block:

    $group->membership = ACCESS_PUBLIC;


    Another and an easier way to do this is to modify the drop down box code block instead of commenting it out in mod/groups/views/default/forms/groups/edit.php as follow:

    <div style="display:none;">
            <?php echo elgg_echo('groups:membership'); ?><br />
            <?php echo elgg_view('input/access', array(
                'name' => 'membership',
                'value' => $membership,
                'options_values' => array(
                    //ACCESS_PRIVATE => elgg_echo('groups:access:private'),
                    ACCESS_PUBLIC => elgg_echo('groups:access:public')


    Finally, the best and recommended way doing this is to create your own plugin that will have this modified group edit view so that it overrides that one view included in the default Elgg Groups plugin installation.  If you upgrade your Elgg installation later, you will not lose your modifications.

    Hope that helps!




  • @Shrek8 - Thanks for that explanation, from me and everyone else who... because of whatever circumstances... is using this group to learn php and get to grips with elgg. Good on ya