@@ -95,10 +95,6 @@ public static function nodeinfo( $request ) {
9595 'outbound ' => array (),
9696 );
9797
98- $ nodeinfo ['metadata ' ] = array (
99- 'email ' => \get_option ( 'admin_email ' ),
100- );
101-
10298 return new \WP_REST_Response ( $ nodeinfo , 200 );
10399 }
104100
@@ -120,13 +116,24 @@ public static function nodeinfo2( $request ) {
120116 'version ' => \get_bloginfo ( 'version ' ),
121117 );
122118
123- $ users = \count_users ();
119+ $ users = \get_users (
120+ array (
121+ 'capability__in ' => array ( 'publish_posts ' ),
122+ )
123+ );
124+
125+ if ( is_array ( $ users ) ) {
126+ $ users = count ( $ users );
127+ } else {
128+ $ users = 1 ;
129+ }
130+
124131 $ posts = \wp_count_posts ();
125132 $ comments = \wp_count_comments ();
126133
127134 $ nodeinfo ['usage ' ] = array (
128135 'users ' => array (
129- 'total ' => (int ) $ users[ ' total_users ' ] ,
136+ 'total ' => (int ) $ users ,
130137 ),
131138 'localPosts ' => (int ) $ posts ->publish ,
132139 'localComments ' => (int ) $ comments ->approved ,
@@ -140,10 +147,6 @@ public static function nodeinfo2( $request ) {
140147 'outbound ' => array (),
141148 );
142149
143- $ nodeinfo ['metadata ' ] = array (
144- 'email ' => \get_option ( 'admin_email ' ),
145- );
146-
147150 return new \WP_REST_Response ( $ nodeinfo , 200 );
148151 }
149152
0 commit comments