Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masterbar: Proposal - Do not sign out by default from wpcom when clicking the Sign out link #8243

Merged
merged 3 commits into from
Feb 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.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' );
}
}
Expand Down