public function init() { $this->setLabel(__('Assigned To', 'buggypress')); $users = get_users(array('orderby' => 'display_name', 'order' => 'ASC', 'fields' => array('ID', 'display_name', 'user_login'))); $assignee = 0; if (isset($this->_issue)) { $assignee = $this->_issue->get_assignee_id(); } if ($assignee) { $assigned_user = new WP_User($assignee); if ($assigned_user->ID) { $this->addMultiOption($assigned_user->ID, $assigned_user->display_name); } } foreach ($users as $user) { if ($user->ID != $assignee) { $label = $user->display_name; if ($user->display_name != $user->user_login) { $label .= "({$user->user_login})"; } $this->addMultiOption($user->ID, $label); } } $this->addMultiOption(0, __('Unassigned', 'buggypress')); $this->setValue($assignee); }
public function render($post) { $issue = new BuggyPress_Issue($post->ID); $users = get_users(); $assignee = $issue->get_assignee_id(); include BuggyPress::plugin_path('views/admin/meta-box-assignee.php'); }
/** * @param string $field * @return mixed */ private function get_old_value($field) { switch ($field) { case 'title': return $this->issue->get_title(); case 'description': return $this->issue->get_description(); case 'project': return $this->issue->get_project_id(); case 'assignee': return $this->issue->get_assignee_id(); case 'type': return $this->issue->get_type(); case 'status': return $this->issue->get_status(); case 'resolution': return $this->issue->get_resolution(); case 'priority': return $this->issue->get_priority(); default: return apply_filters('buggypress_issue_old_value', '', $field); } }