Compare commits
2 commits
add/extend
...
add/filter
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8aa6def9b0 | ||
![]() |
48ab6e53cc |
3 changed files with 21 additions and 5 deletions
|
@ -37,6 +37,19 @@ class Admin {
|
|||
|
||||
$followers_list_page = \add_users_page( \__( 'Followers', 'activitypub' ), \__( 'Followers', 'activitypub' ), 'read', 'activitypub-followers-list', array( self::class, 'followers_list_page' ) );
|
||||
|
||||
add_filter( "manage_{$followers_list_page}_columns", array( '\Activitypub\Table\Followers', 'get_default_columns' ) );
|
||||
add_filter(
|
||||
'screen_options_show_screen',
|
||||
function( $show_screen, $screen ) use ( $followers_list_page ) {
|
||||
if ( $followers_list_page === $screen->base ) {
|
||||
return true;
|
||||
}
|
||||
return $show_screen;
|
||||
},
|
||||
2,
|
||||
10
|
||||
);
|
||||
|
||||
\add_action( 'load-' . $followers_list_page, array( self::class, 'add_followers_list_help_tab' ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ if ( ! \class_exists( '\WP_List_Table' ) ) {
|
|||
}
|
||||
|
||||
class Followers extends WP_List_Table {
|
||||
public function get_columns() {
|
||||
public static function get_default_columns() {
|
||||
return array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'avatar' => \__( 'Avatar', 'activitypub' ),
|
||||
|
@ -21,6 +21,10 @@ class Followers extends WP_List_Table {
|
|||
);
|
||||
}
|
||||
|
||||
public function get_columns() {
|
||||
return self::get_default_columns();
|
||||
}
|
||||
|
||||
public function get_sortable_columns() {
|
||||
return array();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
<?php $followes_table = new \Activitypub\Table\Followers(); ?>
|
||||
<div class="wrap">
|
||||
<h1><?php \esc_html_e( 'Followers', 'activitypub' ); ?></h1>
|
||||
|
||||
<?php // translators: ?>
|
||||
<p><?php \printf( \esc_html__( 'You currently have %s followers.', 'activitypub' ), \esc_attr( \Activitypub\Collection\Followers::count_followers( \get_current_user_id() ) ) ); ?></p>
|
||||
|
||||
<?php $token_table = new \Activitypub\Table\Followers(); ?>
|
||||
|
||||
<form method="get">
|
||||
<input type="hidden" name="page" value="activitypub-followers-list" />
|
||||
<?php
|
||||
$token_table->prepare_items();
|
||||
$token_table->display();
|
||||
$followes_table->prepare_items();
|
||||
$followes_table->display();
|
||||
?>
|
||||
<?php wp_nonce_field( 'activitypub-followers-list', '_apnonce' ); ?>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue