Need public access for all images

Hi,

We have configured the site for 'Logged-In - [Restrict pages to logged-in users]' users but we need to make some user's uploaded pictures[TidyPics] as public access for web services.

We have checked the profile picture accessing method, it seems they have used mysql query directly for getting user's profile image and load the Elgg engine at end of the file.

All ideas are appreciated.

Thanks

-Anand

  • http://learn.elgg.org/en/1.10/guides/actions.html

    Permissions

    By default, actions are only available to logged in users.

    To make an action available to logged out users, pass "public" as the third parameter:

    elgg_register_action("example", $filepath, "public");

    To restrict an action to only administrators, pass "admin" for the last parameter:

    elgg_register_action("example", $filepath, "admin");

  • Thank you! Cim.

    I will give a try and will back asap.

    Thanks! again

  • Seems, you need to expose some pages. Cim's code will help you in exposing actions to guests. You may be looking for http://learn.elgg.org/en/1.10/guides/walled-garden.html

  • There's the "public" access level (site content item specific) and there are "public pages" (in context of walled garden, i.e. pages a visitor who's not logged in is allowed to see on a walled garden site).

    I think this topic is about a "public pages" issue with Tidypics on a walled garden site. Though the "public" access level also is to kept in mind here.

    First thing: make Tidypics pages (photos / albums etc.) "public pages". This can be achived by using the 'public_pages', 'walled_garden' plugin hook.

    Define a plugin hook handler in a init function (for example in a collected customizations plugin):

    elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'public_photo_pages');

    Then also add the callback function to the same start.php:

    function public_photo_pages($hook, $handler, $return, $params) {
        $pages = array('photos/.*');
        return array_merge($pages, $return);
    }

    This makes all Tidypic pages public pages. If you want to restrict it to specific pages, you need to add each of these specific pages in the $pages array in the callback function instead of using the ".*" wildcard. Image-based (or even user-based) restrictions might be difficult to define though. Also, the access level of the images (or more precisely the access level of the album which defines the access level of its images) define which images can be seen even if the page is a public page. This means that not only the page needs to be public but the album needs to have "public" as access level. If the access level is any different, the images / albums will stay invisible for the anonymous visitors. Group albums are another matter. If the group access is not "public" the group albums/images will stay hidden even if the group album has a public access level.

  • Many thanks to you! Very clear explanation and hook handles, this helps me a lot.

    Works Perfect!

    PS: we love Tidypics!

    Thank you all for your support!