Page class method differences
I'm using a regular CI controller to enhance data in a CMS page (the index), using Fuel v1.3. The CMS page uses a custom layout.
While the page is published it works, and when unpublished, and logged in, the page returns but with the inline edit message "The page is not published", which is as expected. However, when not logged in, the unpublished page returns an empty blank page. I'd prefer it to 404. So I looked up the Page class methods, and used get() to fetch the page object. It always returns the is_published value as 1, even when the page is conspicuously unpublished. Using another method, find(), fails to even find an unpublished page (but returns true if it is published). That's what I need, so in the __construct() I add:
$page = $this->fuel->pages->find(uri_segment(1));
if(!is_array($page) || $page['published'] == 'no') {
show_404();
}
Why is there a difference between pages->get() and pages->find() in this circumstance, regarding the published status?
Incidentally, the documentation suggests find() returns an object, but I get an array()
Comments
$this->fuel->pages->get('test', array('render_mode' => 'cms'));