diff --git a/admin.php b/admin.php index 8f4ba21..5becb39 100644 --- a/admin.php +++ b/admin.php @@ -15,6 +15,10 @@ function sc_register_social_connect_settings() { register_setting( 'social-connect-settings-group', 'social_connect_twitter_consumer_key' ); register_setting( 'social-connect-settings-group', 'social_connect_twitter_consumer_secret' ); + register_setting( 'social-connect-settings-group', 'social_connect_google_plus_enabled' ); + register_setting( 'social-connect-settings-group', 'social_connect_google_plus_client_id' ); + register_setting( 'social-connect-settings-group', 'social_connect_google_plus_client_secret' ); + register_setting( 'social-connect-settings-group', 'social_connect_google_enabled' ); register_setting( 'social-connect-settings-group', 'social_connect_yahoo_enabled' ); register_setting( 'social-connect-settings-group', 'social_connect_wordpress_enabled' ); @@ -81,11 +85,37 @@ function sc_render_social_connect_settings() { +

+

Client ID and a Client Secret.', 'social_connect'); ?>

+

Google+ Project List', 'social_connect'), 'https://console.developers.google.com/project'); ?>

+

Create a project, enable Google+ API and create a new Client ID with the details below:', 'social_connect'), 'https://console.developers.google.com/project'); ?>

+
    +
  1. Web Application', 'social_connect'); ?>
  2. +
  3. <YOUR SITE DOMAIN>', 'social_connect'); ?>
  4. +
  5. %1$s', 'social_connect'), SOCIAL_CONNECT_GOOGLE_PLUS_REDIRECT_URL); ?>
  6. +
+ + + + + + + + + + + + + +
+ />
+
+

- + diff --git a/constants.php b/constants.php index 7f53873..e20af86 100644 --- a/constants.php +++ b/constants.php @@ -4,3 +4,4 @@ define( 'SOCIAL_CONNECT_PLUGIN_URL', plugins_url() . '/' . basename( dirname( __FILE__ ))); } +define( 'SOCIAL_CONNECT_GOOGLE_PLUS_REDIRECT_URL', SOCIAL_CONNECT_PLUGIN_URL . '/google-plus/callback.php' ); \ No newline at end of file diff --git a/media/js/connect.js b/media/js/connect.js index 4f08805..e52313b 100644 --- a/media/js/connect.js +++ b/media/js/connect.js @@ -17,6 +17,13 @@ window.open(redirect_uri,'','scrollbars=no,menubar=no,height=400,width=800,resizable=yes,toolbar=no,status=no'); }; + var _do_google_plus_connect = function() { + var google_plus_auth = $('#social_connect_google_plus_auth'); + var redirect_uri = google_plus_auth.find('input[type=hidden][name=redirect_uri]').val(); + + window.open(redirect_uri,'','scrollbars=no,menubar=no,height=400,width=800,resizable=yes,toolbar=no,status=no'); + }; + var _do_yahoo_connect = function() { var yahoo_auth = $('#social_connect_yahoo_auth'); var redirect_uri = yahoo_auth.find('input[type=hidden][name=redirect_uri]').val(); @@ -79,6 +86,10 @@ _do_google_connect(); }); + $(".social_connect_login_google_plus").on("click", function() { + _do_google_plus_connect(); + }); + $(".social_connect_login_yahoo").on("click", function() { _do_yahoo_connect(); }); diff --git a/social-connect.php b/social-connect.php index 81e1811..33de125 100644 --- a/social-connect.php +++ b/social-connect.php @@ -86,6 +86,9 @@ function sc_parse_request($wp) { case 'google': require_once 'google/connect.php'; break; + case 'google-plus': + require_once 'google-plus/connect.php'; + break; case 'yahoo': require_once 'yahoo/connect.php'; break; @@ -152,6 +155,9 @@ function sc_social_connect_process_login( $is_ajax = false ) { $sc_name = $sc_first_name . ' ' . $sc_last_name; $user_login = strtolower( $sc_first_name.$sc_last_name ); break; + case 'google-plus': + die('asdf'); + break; case 'yahoo': $sc_provider_identity = $_REQUEST[ 'social_connect_openid_identity' ]; social_connect_verify_signature( $sc_provider_identity, $sc_provided_signature, $redirect_to ); diff --git a/ui.php b/ui.php index 72c939e..013afb7 100644 --- a/ui.php +++ b/ui.php @@ -15,12 +15,13 @@ function sc_render_login_form_social_connect( $args = NULL ) { $twitter_enabled = get_option( 'social_connect_twitter_enabled' ) && get_option( 'social_connect_twitter_consumer_key' ) && get_option( 'social_connect_twitter_consumer_secret' ); $facebook_enabled = get_option( 'social_connect_facebook_enabled', 1 ) && get_option( 'social_connect_facebook_api_key' ) && get_option( 'social_connect_facebook_secret_key' ); + $google_plus_enabled = get_option( 'social_connect_google_plus_enabled', 1 ); $google_enabled = get_option( 'social_connect_google_enabled', 1 ); $yahoo_enabled = get_option( 'social_connect_yahoo_enabled', 1 ); $wordpress_enabled = get_option( 'social_connect_wordpress_enabled', 1 ); ?> - +

@@ -34,6 +35,9 @@ function sc_render_login_form_social_connect( $args = NULL ) { Twitter'); endif; ?> + Google+'); + endif; ?> Google'); endif; ?> @@ -57,6 +61,7 @@ function sc_render_login_form_social_connect( $args = NULL ) {

+
Googledeprecated)', 'social_connect'), 'https://developers.google.com/+/api/auth-migration'); ?> />