summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/masterbar/masterbar.php')
-rw-r--r--plugins/jetpack/modules/masterbar/masterbar.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/plugins/jetpack/modules/masterbar/masterbar.php b/plugins/jetpack/modules/masterbar/masterbar.php
index c634c9f8..d38b9e67 100644
--- a/plugins/jetpack/modules/masterbar/masterbar.php
+++ b/plugins/jetpack/modules/masterbar/masterbar.php
@@ -40,10 +40,13 @@ class A8C_WPCOM_Masterbar {
'//2.gravatar.com',
) );
- // Atomic only - override user setting that hides masterbar from site's front.
- // https://github.com/Automattic/jetpack/issues/7667
+ // Atomic only
if ( jetpack_is_atomic_site() ) {
+ // override user setting that hides masterbar from site's front.
+ // https://github.com/Automattic/jetpack/issues/7667
add_filter( 'show_admin_bar', '__return_true' );
+ // Always sign out from .com from the masterbar
+ add_filter( 'jetpack_masterbar_should_logout_from_wpcom', '__return_true' );
}
$this->user_data = Jetpack::get_connected_user_data( $this->user_id );
@@ -84,7 +87,19 @@ class A8C_WPCOM_Masterbar {
}
public function maybe_logout_user_from_wpcom() {
- if ( isset( $_GET['context'] ) && 'masterbar' === $_GET['context'] ) {
+ /**
+ * Whether we should sign out from wpcom too when signing out from the masterbar.
+ *
+ * @since 5.9.0
+ *
+ * @param bool $masterbar_should_logout_from_wpcom False by default.
+ */
+ $masterbar_should_logout_from_wpcom = apply_filters( 'jetpack_masterbar_should_logout_from_wpcom', false );
+ if (
+ isset( $_GET['context'] ) &&
+ 'masterbar' === $_GET['context'] &&
+ $masterbar_should_logout_from_wpcom
+ ) {
do_action( 'wp_masterbar_logout' );
}
}
@@ -138,7 +153,15 @@ class A8C_WPCOM_Masterbar {
array(),
JETPACK__VERSION
);
- wp_enqueue_script( 'a8c_wpcom_masterbar_tracks_events', plugins_url( 'tracks-events.js', __FILE__ ), array( 'jquery' ), JETPACK__VERSION );
+ wp_enqueue_script(
+ 'a8c_wpcom_masterbar_tracks_events',
+ Jetpack::get_file_url_for_environment(
+ '_inc/build/masterbar/tracks-events.min.js',
+ 'modules/masterbar/tracks-events.js'
+ ),
+ array( 'jquery' ),
+ JETPACK__VERSION
+ );
wp_enqueue_script( 'a8c_wpcom_masterbar_overrides', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/masterbar.js' ), array( 'jquery' ), JETPACK__VERSION );
}
@@ -852,7 +875,7 @@ class A8C_WPCOM_Masterbar {
$theme_title = $this->create_menu_item_pair(
array(
- 'url' => 'https://wordpress.com/design/' . esc_attr( $this->primary_site_slug ),
+ 'url' => 'https://wordpress.com/themes/' . esc_attr( $this->primary_site_slug ),
'id' => 'wp-admin-bar-themes',
'label' => esc_html__( 'Themes', 'jetpack' ),
),