Skip to content

Commit

Permalink
Jetpack: build_connect_url()
Browse files Browse the repository at this point in the history
Allow `$auth_type` to be filtered so that folks can choose
where their site completes authorization.
  • Loading branch information
roccotripaldi committed Oct 12, 2016
1 parent f5773b8 commit 56a219f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion class.jetpack.php
Expand Up @@ -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',
Expand All @@ -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' ),
Expand Down

0 comments on commit 56a219f

Please sign in to comment.