Skip to content

Commit

Permalink
Default to not log out from wpcom when clicking on the Masterbar Sign…
Browse files Browse the repository at this point in the history
… Out link
  • Loading branch information
oskosk committed Nov 24, 2017
1 parent 828774e commit 0b5e19e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions modules/masterbar/masterbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ function __construct() {
return;
}

// 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 );
Expand Down Expand Up @@ -75,7 +78,19 @@ function __construct() {
}

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.6.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' );
}
}
Expand Down

0 comments on commit 0b5e19e

Please sign in to comment.