PluginProbe
Independent Analytics – WordPress Analytics Plugin / 2.14.10
Independent Analytics – WordPress Analytics Plugin v2.14.10
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / IAWP / ColumnOptions / Plugins / Authors.php
Authors.php
24 lines 699 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IAWP\ColumnOptions\Plugins;
4
5 use IAWP\ColumnOptions\Option;
6 use IAWP\ColumnOptions\OptionsPlugin;
7 /** @internal */
8 class Authors implements OptionsPlugin
9 {
10 public function get_options() : array
11 {
12 $roles_that_can_edit_posts = [];
13 foreach (\wp_roles()->roles as $role_name => $role_obj) {
14 if ($role_obj['capabilities']['edit_posts'] ?? \false) {
15 $roles_that_can_edit_posts[] = $role_name;
16 }
17 }
18 $authors = \get_users(['role__in' => $roles_that_can_edit_posts]);
19 return \array_map(function ($author) {
20 return new Option($author->ID, $author->display_name);
21 }, $authors);
22 }
23 }
24