@@ -279,8 +279,8 @@ private static function should_show_upgrade_menu() {
279279 }
280280 }
281281
282- // Only show after the site is connected.
283- if ( ! self ::is_site_connected () ) {
282+ // Only show after the site and current user are connected.
283+ if ( ! self ::is_site_and_user_connected () ) {
284284 return false ;
285285 }
286286
@@ -289,25 +289,30 @@ private static function should_show_upgrade_menu() {
289289 }
290290
291291 /**
292- * Checks whether the site is connected to WordPress.com.
292+ * Checks whether the site and current user are connected to WordPress.com.
293293 *
294- * @return bool True if the site has a connected blog ID .
294+ * @return bool True if site and current user are connected .
295295 */
296- private static function is_site_connected () {
296+ private static function is_site_and_user_connected () {
297297 $ connection_manager = self ::$ connection_manager ;
298298 if ( ! $ connection_manager && class_exists ( '\Automattic\Jetpack\Connection\Manager ' ) ) {
299299 $ connection_manager = new \Automattic \Jetpack \Connection \Manager ();
300300 }
301301
302- if ( $ connection_manager && is_callable ( array ( $ connection_manager , 'is_connected ' ) ) ) {
303- return (bool ) $ connection_manager ->is_connected ();
302+ if (
303+ $ connection_manager
304+ && is_callable ( array ( $ connection_manager , 'is_connected ' ) )
305+ && is_callable ( array ( $ connection_manager , 'is_user_connected ' ) )
306+ ) {
307+ return (bool ) $ connection_manager ->is_connected ()
308+ && (bool ) $ connection_manager ->is_user_connected ( get_current_user_id () );
304309 }
305310
306311 return false ;
307312 }
308313
309314 /**
310- * Sets the connection manager dependency.
315+ * Sets the connection manager dependency; used by tests .
311316 *
312317 * @param object|null $connection_manager Connection manager object.
313318 * @return void
0 commit comments