public function init() { $this->setLabel(__('Priority', 'buggypress')); $terms = BuggyPress_Issue::get_priorities(); foreach ($terms as $term) { $this->addMultiOption($term->term_id, $term->name); } if (isset($this->_filter)) { $this->setValue($this->_filter->get_priority()); } }
/** * Get a user's currently set filter ID * @param int $user_id * @return BuggyPress_Filter */ private function get_current_filter() { return BuggyPress_Filter::current_filter(); }
/** * Create a new default filter for the given user * * Note: this expects to be called before headers are sent. * * @static * @param $user_id * @return int */ private static function create_user_filter($user_id) { $post = array('post_author' => $user_id, 'post_status' => $user_id ? 'private' : 'draft', 'post_type' => self::POST_TYPE, 'post_title' => sprintf(__('User Filter %d', 'buggypress'), $user_id)); $post_id = wp_insert_post($post); if ($user_id) { update_user_option($user_id, 'issue_filter', $post_id); } else { $key = 'bp_issue_filter_' . wp_generate_password(12, FALSE); set_transient($key, $post_id, 60 * 60 * 24 * 7); setcookie('bp_issue_filter', $key, time() + 60 * 60 * 24 * 7, COOKIEPATH, COOKIE_DOMAIN, NULL, TRUE); } $filter = new BuggyPress_Filter($post_id); $filter->set_default_filters(); return $post_id; }