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 27, 2017
1 parent cf951b2 commit a092054
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 @@ -40,10 +40,13 @@ function __construct() {
'//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 );
Expand Down Expand Up @@ -84,7 +87,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 a092054

Please sign in to comment.