private_profile standard stopping site pages from working

Hi

I have been messing around with this for a few ways now and Thanks to iionly i can now hide the admin users but now for some reason and even with an unmodified version of private profile the about , terms and privacy pages will not work for longed out users .it says "This page has not been set up yet."

 

Any idea what could be causing this , its definitely not the changes we made to the mod its something in the mod doing it .

  • The text "This page has not been set up yet." is displayed if you haven't entered any content for the corresponding external page in the admin section. Are you sure you have entered anything? Is the text you have entered displayed when logged in but not when logged out or do you always get the "This page has not been set up yet." output?

  • HI

    The 3 pages display fine when you are logged in, but will not when you are logged out , also the problem only happens when i have the private profile mod activated , I disable it , then the pages display fine when im logged out ,, about private and terms, I thaught it was maybe something we changed in the private mod , but even with the original privet profile mod there is a problem , I also tried walled garden and normal and it makes no difference.

    Thank you for helping me  

  • Okay. I could reproduce it now. It indeed happens that the content of an external page is not displayed (not the access to the page itself is blocked). This happens if you use the Private Profiles plugin and the admin user who edits the external page has enabled the Private Profiles plugin's setting to hide his public activity. I missed that so far because I had tested on a test installation with the external pages not configured (and on the second time without the Private Profiles setting enabled...).

    Reason for the content not getting displayed is that the external pages entities are saved with the admin user who edits the pages as owner. So, strictly speaking it's public activity of the user who decided to hide this activity...

    To get the external pages to show up to logged out visitors you have two options:

    Either keep the public activity setting of at least one admin disabled and edit the external pages with this admin user only.

    A somewhat "dirty" fix is to modify the external pages plugin to save the external pages entities not with a user as owner but with the site entity instead. The modification would have to be made in mod/externalpages/actions/edit.php:

    // $expages->owner_guid = elgg_get_logged_in_user_guid();
    $expages->owner_guid = elgg_get_site_entity()->guid;
    $expages->access_id = ACCESS_PUBLIC;
    $expages->title = $type;
    $expages->description = $contents;
    if (!$expages->save()) {
        register_error(elgg_echo("expages:error"));
        forward(REFERER);
    }
    

    Afterwards the external pages would have to be saved again (or possible even first saved as blank and then saved again with the desired content).

  • Just as a note: there might be other problems with the admins hidden, especially if you also keep them hidden from logged-in users, too. I can't give you any example what might fail at the moment but if these admins accounts are used to add any content it will cause issues as this content is then strictly unaccessible for normal users or logged out visitors.

  • Thank you so much for your help , I really appreciate it :-)

     

  • am I correct i in saying that this system is a oop framework ? what has composer got to do with it ?

    , Im looking for a light bulb moment here , but so far Im a bit dim :-)

    I created a extra field in the registration page Gender , using profile manager, I now want to set a tiger to forward the user to ether the normal , we have sent you and email , Or a rules page based on gender selection , normal i would add a if then to the registration button , but how would you go about it in elgg as it seems to build these pages on the fly.

    Do you mind teaching ? I had a friend that taught me a lot over the years but I have sadly recently lost touch , and cant find out what happend to him 

     

     

  • The original purpose of composer is management of dependencies (e.g. 3rd party scripts/libs). The developer doesn't have to fetch all the 3rd party code from different sources and add it to the code (e.g. a plugin) but can define the dependencies and let composer do the job.

    For the composer based installation of Elgg to work Elgg itself is defined as a dependency and fetched by composer then. The zip archives of the Elgg releases contain an image of an installation made with composer (simply said) with all the external dependencies already included.

    For developing or customizing Elgg and using composer nonetheless you would have to fork Elgg and then pull your forked Elgg version instead. Strictly speaking, you shouldn't modify Elgg core files though but make all customizations by creating a plugin(s). So, you wouldn't necessarily have to fork Elgg itself. You could also put your plugin(s) on github/packagist and then add them in the composer project as dependencies. Then they will get added to an Elgg installation made by composer. Or you could just copy your own or other additional plugins in the mod folder regardless if it's a composer or zip archive made installation of Elgg.

    Elgg already has some event handlers that get triggered at specifc situations, e.g. a user logs in (see http://learn.elgg.org/en/stable/guides/events-list.html). Another mechanism are plugin hooks that get triggered by Elgg/plugins at specific points.

    The login redirect depending on gender could work with the following code (untested and also the part of the code that checks the gender profile field is not included - you would have to add that on your own depending on the profile field name/type... shouldn't be too complicated):

    <?php
    
    elgg_register_event_handler('init','system','gender_login_init');
    
    function gender_login_init() {
        elgg_register_event_handler('login:after', 'user', 'gender_login_event_handler', 9999);
    }
    
    function gender_login_event_handler($event, $type, $user) {
        if (empty($user) || !elgg_instanceof($user, "user")) {
            return;
        }
    
        elgg_register_plugin_hook_handler("forward", "system", "gender_login_forward_hook");
    }
    
    function gender_login_forward_hook($hook_name, $entity_type, $return_value, $params) {
        
        $user = elgg_get_logged_in_user_entity();
        if (empty($user)) {
            return $return_value;
        }
    
        // HERE YOU HAVE TO ADD THE CODE THAT CHECKS THE GENDER OF THE USER AND SETS THE FORWARD FORWARD URL
        // AS YOU WANT IT TO BE DEPENDING ON THE GENDER
        $return_value = $forward_url;
    
        return $return_value;
    }
  • Im so blown away with the way you know this, i have sat looking  at the registration page for ages, if you call the page , and then view source there are no values set for a drop down of male female and yet it gets  it 100% into the db.

    Thank you so much for your help i will go back and look again with what you have given me ..

    Have an awesome day :-)