How to display the contents of a page when the page is private.

Hi all,

I have a problem with displaying the contents of a page when it's visibility is set to private. essentially what i want is to have some admin-manageable text on my custom index page. I thought i could do it by creating a private page using get_entity to load the title and desc into my index page. The problem is by just doing this the page will only show if it is set to public. This then also means that every user of the site could read the random bits of text.

If anyone can give me some hints as to how i might circumvent the 'visibility' of a page for just my custom index i'd appreicate it.

Thanks all,

Ollie

  • Bad idea. Better to just create a custom ElggObject that saves your text. You could try looking at the blog tutorial on the Docs wiki except make it a tool for the admin to set custom front page text. Then load that object within your custom index and display. Much cleaner than trying to hack the access levels.

  • Ok, so i've followed your advice and have a nice plugin which has a form that i can use to input  strapline and piece of welcome text into an object. I've even managed to protect it form people are not admin! The only issue i have now is that at current when i finally get around to calling 'save' on my object it creates a new record eachtime.

    I've discovered that save() looks to see if a guid is set and otherwise creates a new record, so i tried passing in a guid with $object->guid = 1; but this seems to have no effect. Should i be using something other than save() or am i missing one fundament piece of the puzzle?

    appreicate the help by the way, and even with my issues i'm liking Elgg.

    Ollie

  • Ok scratch that, think i have it working now. Turns out i was going all about creating a new Object but instead i just did get_entity() and then edited and saved it again.

    Thanks.