File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ plugins/*
1616
1717mu-plugins /*
1818! mu-plugins /mu-autoloader.php
19+ ! mu-plugins /activitypub-migration.php
1920! mu-plugins /osi-event-list
2021! mu-plugins /osi-sponsors-list
2122
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Plugin Name: ActivityPub Migration
4+ * Plugin Description: Adds the `blog.opensource.org` to the Actors `alsoKnownAs` list.
5+ * Version: 1.0.0
6+ * Author: WordPress.com Special Projects
7+ * Author URI: https://wpspecialprojects.wordpress.com/
8+ */
9+
10+ if ( ! defined ( 'ABSPATH ' ) ) {
11+ return ;
12+ }
13+
14+ /**
15+ * Adds the `blog.opensource.org` to the Actors `alsoKnownAs` list.
16+ *
17+ * @param array $actor Actor as Array.
18+ *
19+ * @return array $actor Filtered Actor Array.
20+ */
21+ function activitypub_actor_migration ( array $ actor ) {
22+ if ( ! $ actor ) {
23+ return $ actor ;
24+ }
25+
26+ $ host = wp_parse_url ( get_home_url (), PHP_URL_HOST );
27+ $ id = str_replace ( $ host , 'blog. ' . $ host , $ actor ['id ' ] );
28+
29+ $ actor ['alsoKnownAs ' ] = array ( $ id );
30+ return $ actor ;
31+ }
32+ add_filter ( 'activitypub_activity_user_object_array ' , 'activitypub_actor_migration ' );
You can’t perform that action at this time.
0 commit comments