Comment.php
3 months ago
Media.php
3 months ago
NetworkSite.php
3 months ago
NetworkUser.php
3 months ago
Post.php
3 months ago
Taxonomy.php
3 months ago
TotalItemsTrait.php
3 months ago
User.php
3 months ago
NetworkUser.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\ListTable; |
| 4 | |
| 5 | use AC\ListTable; |
| 6 | use WP_MS_Users_List_Table; |
| 7 | |
| 8 | class NetworkUser implements ListTable |
| 9 | { |
| 10 | |
| 11 | private WP_MS_Users_List_Table $table; |
| 12 | |
| 13 | public function __construct(WP_MS_Users_List_Table $table) |
| 14 | { |
| 15 | $this->table = $table; |
| 16 | } |
| 17 | |
| 18 | public function render_cell(string $column_id, $row_id): string |
| 19 | { |
| 20 | $user = get_userdata($row_id); |
| 21 | |
| 22 | if ( ! $user) { |
| 23 | return ''; |
| 24 | } |
| 25 | |
| 26 | ob_start(); |
| 27 | |
| 28 | $method = 'column_' . $column_id; |
| 29 | |
| 30 | if (method_exists($this->table, $method)) { |
| 31 | call_user_func([$this->table, $method], $user); |
| 32 | } else { |
| 33 | $this->table->column_default($user, $column_id); |
| 34 | } |
| 35 | |
| 36 | return ob_get_clean(); |
| 37 | } |
| 38 | |
| 39 | public function render_row($id): string |
| 40 | { |
| 41 | $user = get_userdata($id); |
| 42 | |
| 43 | if ( ! $user) { |
| 44 | return ''; |
| 45 | } |
| 46 | |
| 47 | ob_start(); |
| 48 | |
| 49 | $this->table->single_row($user); |
| 50 | |
| 51 | return ob_get_clean(); |
| 52 | } |
| 53 | |
| 54 | } |