elgg_access_collections

Hello all!

Can someone tell me how to grab the id from the elgg_access_collections when all I have is the owner_guid? (The function get_access_collection() seems to require the id, which is the one piece of info that I'm trying to get.)

I'm trying to extend the access permissions for group postings (as spit out by echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ) so that they default to the group name. The settings panel only allows me to set the default to private, friends, logged-in, or public. If I can grab the id, I can set the default value on the form to the group.

Any suggestions?

Thanks!

  • Within most forms, elgg_get_page_owner_entity() will return the group. So:

    $owner = elgg_get_page_owner_entity();
    if ($owner instanceof ElggGroup) {
        $acl = $owner->group_acl;
    }

    I have a brand new plugin that may help you though. It gives you a cleaner (in my opinion) API to modify the default access level and the options. You create a modifier class (this is the default one that comes with the plugin) and it gets passed useful context info about the page owner/group and all the data passed to the input/access view.

  • Steve,

    A belated thank you--I think this will work much better than my workaround (a function that manually lists group ids, and which would quickly become unwieldy).

    --Gabe