/** * Adds new roles if they are missing. Also takes care of other access control * related filters. * * @return void */ public function init() { global $wp_roles; if (!$wp_roles->is_role('production')) { // to update the role, I had to run `remove_role()` first #YAWPH add_role('production', 'Production Staff', array('upload_files' => true, 'edit_posts' => false, 'delete_posts' => true, 'read' => true)); } $user = $this->theme->userMetaToData(get_current_user_id()); if (!empty($user['show_only_owned_posts'])) { add_filter('pre_get_posts', array($this, 'limitPostsToUser')); } }
/** * Any meta boxes that go on the user profile page * * @param WP_User $user The user object * @return void */ public function userPage($user) { // only show these options to administrators if (current_user_can('delete_users')) { $this->theme->set('userId', $user->ID); $this->theme->set('data', $this->theme->userMetaToData($user->ID)); echo $this->theme->render('admin'.DS.'user_details'); } }