Allow setting Jetpack connection when JETPACK_MASTER_USER isn't available (https://github.com/woocommerce/woocommerce-admin/pull/5880)
* Allow setting Jetpack connection when JETPACK_MASTER_USER isn't available * Fix linting * Fix lint * Update OnboardingSetUpShipping.php Added filter description
This commit is contained in:
parent
e342864b74
commit
fbcc65034f
|
@ -63,8 +63,18 @@ class OnboardingSetUpShipping {
|
|||
return;
|
||||
}
|
||||
|
||||
$user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
|
||||
$jetpack_connected = isset( $user_token->external_user_id );
|
||||
if ( defined( 'JETPACK_MASTER_USER' ) ) {
|
||||
$user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
|
||||
$jetpack_connected = isset( $user_token->external_user_id );
|
||||
} else {
|
||||
/**
|
||||
* Filter allowing to set the status of the jetpack connection wiuthout setting constant `JETPACK_MASTER_USER`
|
||||
*
|
||||
* @param bool $is_connected False.
|
||||
*/
|
||||
$jetpack_connected = apply_filters( 'woocommerce_admin_is_jetpack_connected', false );
|
||||
}
|
||||
|
||||
$wcs_version = \WC_Connect_Loader::get_wcs_version();
|
||||
$wcs_tos_accepted = \WC_Connect_Options::get_option( 'tos_accepted' );
|
||||
|
||||
|
|
|
@ -59,9 +59,14 @@ class ShippingLabelBanner {
|
|||
$wcs_tos_accepted = null;
|
||||
|
||||
if ( class_exists( '\Jetpack_Data' ) ) {
|
||||
$user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
|
||||
|
||||
$jetpack_connected = isset( $user_token->external_user_id );
|
||||
if ( defined( 'JETPACK_MASTER_USER' ) ) {
|
||||
$user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
|
||||
$jetpack_connected = isset( $user_token->external_user_id );
|
||||
} else {
|
||||
$jetpack_connected = apply_filters( 'woocommerce_admin_is_jetpack_connected', false );
|
||||
}
|
||||
|
||||
$jetpack_version = JETPACK__VERSION;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue