From 0aaed7a85c0206113bb3e03c07cee3ae91a2bcd4 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 6 May 2025 11:58:47 +0200 Subject: [PATCH 1/2] Add Dashboard widgets for ActivityPub profiles The profiles are no loner part of the welcome page, see #1625 This PR adds them as Dashboard widgets. --- includes/wp-admin/class-admin.php | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/includes/wp-admin/class-admin.php b/includes/wp-admin/class-admin.php index 481c8e059..c9e318e99 100644 --- a/includes/wp-admin/class-admin.php +++ b/includes/wp-admin/class-admin.php @@ -10,6 +10,8 @@ use Activitypub\Comment; use Activitypub\Collection\Actors; use Activitypub\Collection\Extra_Fields; +use Activitypub\Model\Blog; + use function Activitypub\count_followers; use function Activitypub\get_content_visibility; use function Activitypub\is_user_type_disabled; @@ -670,6 +672,12 @@ function ( $id ) { */ public static function add_dashboard_widgets() { \wp_add_dashboard_widget( 'activitypub_blog', \__( 'ActivityPub Plugin News', 'activitypub' ), array( self::class, 'blog_dashboard_widget' ) ); + if ( user_can_activitypub( \get_current_user_id() ) && ! is_user_type_disabled( 'user' ) ) { + \wp_add_dashboard_widget( 'activitypub_profile', \__( 'ActivityPub Author profile', 'activitypub' ), array( self::class, 'profile_dashboard_widget' ) ); + } + if ( ! is_user_type_disabled( 'blog' ) ) { + \wp_add_dashboard_widget( 'activitypub_blog_profile', \__( 'ActivityPub Blog profile', 'activitypub' ), array( self::class, 'blogprofile_dashboard_widget' ) ); + } } /** @@ -688,4 +696,46 @@ public static function blog_dashboard_widget() { ); echo ''; } + + /** + * Add the ActivityPub Author profile as a Dashboard widget. + */ + public static function profile_dashboard_widget() { + $user = Actors::get_by_id( \get_current_user_id() ); + ?> +

+ +

+

+

+

+ + + + +

+ +

+ +

+

+

+

+ + + + + + +

+ Date: Tue, 6 May 2025 12:03:14 +0200 Subject: [PATCH 2/2] Add changelog --- .github/changelog/1658-from-description | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/changelog/1658-from-description diff --git a/.github/changelog/1658-from-description b/.github/changelog/1658-from-description new file mode 100644 index 000000000..95aa37a22 --- /dev/null +++ b/.github/changelog/1658-from-description @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Profile sections have been moved from the Welcome page to new Dashboard widgets for easier access.