From 56a219fe902a40c2cc896ecb30171005b44ba74e Mon Sep 17 00:00:00 2001 From: roccotripaldi Date: Wed, 12 Oct 2016 13:58:45 -0400 Subject: [PATCH] Jetpack: build_connect_url() Allow `$auth_type` to be filtered so that folks can choose where their site completes authorization. --- class.jetpack.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/class.jetpack.php b/class.jetpack.php index a48a2be9aca22..d48266c70c793 100644 --- a/class.jetpack.php +++ b/class.jetpack.php @@ -3848,6 +3848,17 @@ function build_connect_url( $raw = false, $redirect = false, $from = false ) { ? get_site_icon_url() : false; + /** + * Filter the type of authorization. + * 'calypso' completes authorization on wordpress.com/jetpack/connect + * while 'jetpack' ( or any other value ) completes the authorization at jetpack.wordpress.com. + * + * @since 4.3.3 + * + * @param string $auth_type Defaults to 'calypso', can also be 'jetpack'. + */ + $auth_type = apply_filters( 'jetpack_auth_type', 'calypso' ); + $args = urlencode_deep( array( 'response_type' => 'code', @@ -3866,7 +3877,7 @@ function build_connect_url( $raw = false, $redirect = false, $from = false ) { 'user_login' => $user->user_login, 'is_active' => Jetpack::is_active(), 'jp_version' => JETPACK__VERSION, - 'auth_type' => 'calypso', + 'auth_type' => $auth_type, 'secret' => $secret, 'locale' => isset( $gp_locale->slug ) ? $gp_locale->slug : '', 'blogname' => get_option( 'blogname' ),