/** * Returns true if slug is not being used * * @param string * @return bool */ public function validSlug($slug) { User_Error::i()->argument(1, 'string'); $row = $this->_database->getRow('user', 'user_slug', $slug); //if there is no slug if (empty($row)) { //it's valid return true; } //if slug is set and slugs are equal and user ids are equal if (isset($this->_data['user_slug']) && $this->_data['user_slug'] == $row['user_slug'] && $this->_data['user_id'] == $row['user_id']) { return true; } return false; }