function children($limit = null, $offset = null, $where = array(), $order_by = null) { if (!hide::can_view_hidden_items($this)) { $this->join("hidden_items", "items.id", "hidden_items.item_id", "LEFT OUTER"); $this->where("hidden_items.item_id", "IS", NULL); return parent::children($limit, $offset, $where, $order_by); } }
static function viewable($model) { $model = parent::viewable($model); if (!hide::can_view_hidden_items($model)) { // only fetches items that are not hidden $model->join("hidden_items", "items.id", "hidden_items.item_id", "LEFT OUTER")->and_where("hidden_items.item_id", "IS", NULL); } return $model; }