Walled Garden access

I am running my site in walled garden mode and everything was fine till I had a requirement to make blogs view only public. I was able to make blogs public through external pages plugin and/or public pages plugin. My problem though is now blogs are not created with Public access in walled garden mode, they are always private, friends and logged in. Can I create blogs with public access in walled garden mode?

The only work around I have now is making site public, create blog, and make site private back again.

Thanks in advance for any solutions.

  • Right, there is some progress! Its working, but, the rss page is blank. I assume this is because the content is set to "logged in users". So now I have to know how to set it to public. I do not see Public in the access menu when making blogs. If I can learn how to do that, it will all be working!

  • I've already explained how to get the public access level back when using the Loginrequired plugin in one of my previous postings. When using the Elgg internal walled-garden option the necessary changes are quite similar (but not necessarily the same). But I really don't have the time to look into everything in detail and then also post detailed step-by-step instructions for everything.

  • Please tell me how to do it. My wire pages are working and accessible to the public. I didn't need to do anything. It's just the blogs. If the necessary changes are similar will it really take so much time to tell me them? Please help!

  • In the init function of the plugin you created to define the plugin pages add the line

    elgg_unregister_plugin_hook_handler('access:collections:write', 'all', '_elgg_walled_garden_remove_public_access');

    Secondly, copy the file mod/groups/views/default/groups/edit/access.php in your plugin in the corresponding location (i.e. create the folders/subfolders mod/YOUR_PLUGIN_NAME/views/default/groups/edit/ and copy the access.php file into it). The edit the copy and remove the lines 42-42

    if (elgg_get_config("walled_garden")) {
        unset($visibility_options[ACCESS_PUBLIC]);
    }

    With the plugin handler unregisted in the init function and the changed access.php (which overrides the Elgg core file automatically as long as your plugin is ordered below the groups plugin) everyone has again the public access level.

    So, that was DEFINITELY my last reply in this thread!

  • Absolutely does not work.

    I even activated groups because your instructions imply its access to groups, rather than blog. Doesn't work either. Groups activated or not activated, it doesn't work. I did exactly what you told me. It's exactly the same as before.

  • It seems not to work indeed this way. Apparently, the Elgg core plugin hook that unsets the public access level can't be unregistered.

    So, the only way is to use the Loginrequired plugin then. Just comment out the line
    
    elgg_register_plugin_hook_handler('access:collections:write', 'all', 'loginrequired_remove_public_access', 9999);

    in the init function in start.php of Loginrequired and you should be done (i.e. able to edit the access level of the items you want to be public and change their access level accordingly). If you don't use the groups plugin anyway, you wouldn't have to bother with getting the public access level for group content enabled again.

  • The line you have given me doesn't exist in start.php of loginrequired.

  • So, line 23 doesn't exist. Okay. I give up!

  • No it doesn't exist. Here is start.php:

    <?php

     

    /**

    * Log In Required plugin.

    *

    * @package LogInRequired

    * @license http://www.opensource.org/licenses/gpl-license.php

    * @author Khaled Afiouni

    * @copyright skinju.com 2010

    * @link http://skinju.com/

    * Upgraded to Elgg 1.8 by iionly in 2011

    */

     

     

    elgg_register_event_handler('init','system','loginrequired_init');

     

    function loginrequired_init()

    {

     

    global $CONFIG;

     

    // No need to do all the checking below if the user is already logged in... performance is key :)

    if (elgg_is_logged_in()) return;

     

    elgg_extend_view('css/elgg', 'loginrequired/css');

     

    elgg_unextend_view('page/elements/header', 'search/header');

     

    elgg_register_plugin_hook_handler('index','system','loginrequired_index', 1);

     

    elgg_register_plugin_hook_handler('login_required','login_required', 'login_required_default_allowed_list');

     

    // Get the current page URL without any ? & parameters... this is required for the registration page to work properly

    $current_url = current_page_url();

    $parameters_start = strrpos($current_url, '?');

    if ($parameters_start)

    $current_url = substr($current_url, 0, $parameters_start);

     

    // Always allow index page

    if ($current_url == $CONFIG->url) {

    return;

    }

     

    $allow = array();

    // Allow should have pages

    $allow[] = '_graphics';

    $allow[] = 'action/login';

    $allow[] = 'register';

    $allow[] = 'action/register';

    $allow[] = 'forgotpassword';

    $allow[] = 'resetpassword';

    $allow[] = 'action/user/requestnewpassword';

    $allow[] = 'action/user/passwordreset';

    $allow[] = 'action/security/refreshtoken';

    $allow[] = 'ajax/view/js/languages';

    $allow[] = 'upgrade\.php';

    $allow[] = 'xml-rpc\.php';

    $allow[] = 'mt/mt-xmlrpc\.cgi';

    $allow[] = 'css/.*';

    $allow[] = 'js/.*';

    $allow[] = 'cache/css/.*';

    $allow[] = 'cache/js/.*';

     

    // Allow other plugin developers to edit the array values

    $add_allow = elgg_trigger_plugin_hook('login_required','login_required');

     

    // If more URL's are added... merge both with original list

    if (is_array($add_allow))

    $allow = array_merge($allow, $add_allow);

     

    // Any public_pages defined via Elgg's walled garden plugin hook?

    $plugins = elgg_trigger_plugin_hook('public_pages', 'walled_garden', NULL, array());

     

    // If more URL's are added... merge both with original list

    if (is_array($plugins))

    $allow = array_merge($allow, $plugins);

     

    // Check if current page is in allowed list... otherwise redirect to login

    foreach ($allow as $public) {

    $pattern = "`^{$CONFIG->url}$public/*$`i";

    if (preg_match($pattern, $current_url)) {

    return;

    }

    }

     

    gatekeeper();

     

    }

     

    // Add more allowed URL's...

    function login_required_default_allowed_list($hook, $type, $returnvalue, $params) {

    global $CONFIG;

     

    // If externalpages plugin is active allow access to its pages

    $add = array();

    $add[] = 'terms/';

    $add[] = 'terms';

    $add[] = 'privacy/';

    $add[] = 'privacy';

    $add[] = 'about/';

    $add[] = 'about';

     

    return $add;

    }

     

    function loginrequired_index($hook, $type, $returnvalue, $params) {

    if ($return == true) {

    // another hook has already replaced the front page

    return $return;

    }

     

    if (!include_once(dirname(__FILE__) . "/index.php")) {

    return false;

    }

     

    // return true to signify that we have handled the front page

    return true;

    }

     

  • That's not from the latest version of Loginrequired, not even from the latest version of Loginrequired for Elgg 1.8. I really gave all the help I could think of here. If you use outdated plugin versions, possibly an outdated version of Elgg and are not willing to think for yourself for just a few minutes I am not willing to spend any more time here. If you are not able to get it working for yourself, hire a coder.