@@ -728,7 +728,7 @@ public static function get_auth_status() {
728728
729729 $ statuses = array ();
730730
731- $ platforms = array ( 'instagram ' , 'twitter ' , 'facebook ' , 'bluesky ' , 'threads ' , 'pinterest ' , 'reddit ' );
731+ $ platforms = array ( 'instagram ' , 'twitter ' , 'facebook ' , 'bluesky ' , 'threads ' , 'pinterest ' , 'linkedin ' , ' reddit ' );
732732
733733 foreach ( $ platforms as $ platform ) {
734734 $ provider = $ providers [ $ platform ] ?? null ;
@@ -744,10 +744,12 @@ public static function get_auth_status() {
744744 }
745745
746746 /**
747- * Get platform configurations
747+ * Get platform configurations with auth status.
748+ *
749+ * Returns every registered platform's config plus its current
750+ * `authenticated` and `username` fields so callers need only one request.
748751 */
749752 public static function get_platforms () {
750- // Return platform configurations from registry
751753 $ platforms = array (
752754 'instagram ' => array (
753755 'label ' => 'Instagram ' ,
@@ -799,6 +801,14 @@ public static function get_platforms() {
799801 'charLimit ' => 500 ,
800802 'supportsCarousel ' => false ,
801803 ),
804+ 'linkedin ' => array (
805+ 'label ' => 'LinkedIn ' ,
806+ 'maxImages ' => 9 ,
807+ 'aspectRatios ' => array ( 'any ' ),
808+ 'defaultAspectRatio ' => 'any ' ,
809+ 'charLimit ' => 3000 ,
810+ 'supportsCarousel ' => false ,
811+ ),
802812 'reddit ' => array (
803813 'label ' => 'Reddit ' ,
804814 'type ' => 'fetch ' ,
@@ -807,6 +817,17 @@ public static function get_platforms() {
807817 ),
808818 );
809819
820+ // Fold auth status into each platform entry.
821+ $ auth_abilities = new AuthAbilities ();
822+ $ providers = $ auth_abilities ->getAllProviders ();
823+
824+ foreach ( $ platforms as $ slug => &$ config ) {
825+ $ provider = $ providers [ $ slug ] ?? null ;
826+ $ config ['authenticated ' ] = $ provider ? $ provider ->is_authenticated () : false ;
827+ $ config ['username ' ] = $ provider ? $ provider ->get_username () : null ;
828+ }
829+ unset( $ config );
830+
810831 return new \WP_REST_Response ( $ platforms );
811832 }
812833
0 commit comments