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

Blaze: only display UI to English customers. #28266

Merged
merged 7 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions projects/packages/blaze/changelog/update-blaze-conditions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Only display the Blaze UI if the connected user's language is English.
15 changes: 13 additions & 2 deletions projects/packages/blaze/src/class-blaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,21 @@ public function register() {
* @return bool
*/
public static function should_initialize() {
$should_initialize = true;
$should_initialize = true;
$jetpack_connection = new Jetpack_Connection();

// These features currently only work on WordPress.com, so they should be connected for best experience.
if ( ! ( new Jetpack_Connection() )->is_user_connected() ) {
if ( ! $jetpack_connection->is_user_connected() ) {
$should_initialize = false;
}

// We currently do not show the UI for non-English WordPress.com users.
$user_data = $jetpack_connection->get_connected_user_data();
jeherve marked this conversation as resolved.
Show resolved Hide resolved
if (
! empty( $user_data )
jeherve marked this conversation as resolved.
Show resolved Hide resolved
&& ! empty( $user_data['user_locale'] )
&& ! in_array( $user_data['user_locale'], array( 'en', 'en-gb' ), true )
) {
$should_initialize = false;
}

Expand Down