33
44use WP_Error ;
55use Activitypub \Webfinger ;
6+ use Activitypub \Collection \Users ;
67
78use function Activitypub \get_plugin_version ;
9+ use function Activitypub \is_user_type_disabled ;
810use function Activitypub \get_webfinger_resource ;
911
1012/**
@@ -25,10 +27,12 @@ public static function init() {
2527 }
2628
2729 public static function add_tests ( $ tests ) {
28- $ tests ['direct ' ]['activitypub_test_author_url ' ] = array (
29- 'label ' => \__ ( 'Author URL test ' , 'activitypub ' ),
30- 'test ' => array ( self ::class, 'test_author_url ' ),
31- );
30+ if ( ! is_user_type_disabled ( 'user ' ) ) {
31+ $ tests ['direct ' ]['activitypub_test_author_url ' ] = array (
32+ 'label ' => \__ ( 'Author URL test ' , 'activitypub ' ),
33+ 'test ' => array ( self ::class, 'test_author_url ' ),
34+ );
35+ }
3236
3337 $ tests ['direct ' ]['activitypub_test_webfinger ' ] = array (
3438 'label ' => __ ( 'WebFinger Test ' , 'activitypub ' ),
@@ -253,8 +257,15 @@ public static function is_author_url_accessible() {
253257 * @return boolean|WP_Error
254258 */
255259 public static function is_webfinger_endpoint_accessible () {
256- $ user = \wp_get_current_user ();
257- $ account = get_webfinger_resource ( $ user ->ID );
260+ $ user = \wp_get_current_user ();
261+
262+ if ( ! is_user_type_disabled ( 'blog ' ) ) {
263+ $ account = get_webfinger_resource ( $ user ->ID );
264+ } elseif ( ! is_user_type_disabled ( 'user ' ) ) {
265+ $ account = get_webfinger_resource ( Users::BLOG_USER_ID );
266+ } else {
267+ $ account = '' ;
268+ }
258269
259270 $ url = Webfinger::resolve ( $ account );
260271 if ( \is_wp_error ( $ url ) ) {
0 commit comments