using Model to retrieve record by ID but ignore published = "yes"

edited January 2014 in Share
I have a controller that is creating a record in a model dynamically and based off certain parameters it may create that record where published = "no". I'm using $record = $this->model->create($array) and $id = $record->save() but when I do $this->model->find_by_key($id), it returns an empty result because the record was created with 'published' = 'no'. How do I get around this? This is the only spot in the site that I want to access an 'un-published' record -- I want those records hidden otherwise

Comments

  • edited January 2014
    By default, the Base_module_model::_common_query() method (which is inherited by your model) automatically will hide anything with a published status or active status set to no. This can be change by overwriting your _common_query method in your model to not do anything like so:
    function _common_query() { }
Sign In or Register to comment.