Changeset 460801
- Timestamp:
- 11/09/2011 01:57:44 AM (14 years ago)
- Location:
- wp-google-plus-connect/trunk
- Files:
-
- 1 added
- 2 edited
-
buddypress.php (added)
-
readme.txt (modified) (1 diff)
-
wp-google-plus-connect.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-google-plus-connect/trunk/readme.txt
r460383 r460801 1 1 === WP Google Plus Connect === 2 2 Contributors: Messenlehner 3 Tags: google+, google plus, google, plugin, login, admin, bridge, api 3 Tags: google+, google plus, google, plugin, login, admin, bridge, api, buddypress, registration 4 4 Requires at least: 3.0 5 5 Tested up to: 3.1 6 Stable tag: 1.0 6 Stable tag: 1.0.1 7 7 License: GPLv2 or later 8 8 9 W P Google+ Connect allows yourusers to register and/or login via their Google+ account.9 WordPress Google Plus Connect allows your WordPress/BuddyPress users to register and/or login via their Google+ account. 10 10 11 11 == Description == 12 12 13 Allow your WordPress website users the ability to register and/or log in via their Google+ account utilizing the Google+ API. Set up a Google Plus Application and store the API credentials in the WordPress backend, when a user clicks on the "Login with Google+" button that gets added to the WP log in screen or anywhere via a short code and authenticates their Google Plus account a WordPress account will be created with their G+ information and they will automatically be logged in. Any existing WordPress users can also log in via Google+ and link their two accounts. 13 Allow your website members the ability to register and/or log in via their Google+ account utilizing the Google+ API. Set up a Google Plus Application and store the API credentials in the WordPress backend, when a user clicks on the "Login with Google+" button that gets added to the WP log in screen or anywhere via a short code and authenticates their Google Plus account a WordPress account will be created with their G+ information and they will automatically be logged in. Any existing WordPress or BuddyPress users can also log in via Google+ and link their two accounts. 14 14 15 15 16 == Installation == 16 17 17 18 Upload the wp-google-plus-connect plugin to your website, Activate it, then head to the "G+ Connect" link added to the settings menu. 19 20 == Changelog == 21 22 = 1.0 = 23 * Plugin Launch 24 25 = 1.0.1 = 26 * BuddyPress Compatible -
wp-google-plus-connect/trunk/wp-google-plus-connect.php
r460379 r460801 3 3 Plugin Name: WP Google+ Connect 4 4 Plugin URI: http://webdevstudios.com/plugin/wp-google-plus-connect/ 5 Description: Register and/or login WordPress users via their Google+ Account utilizing the Google+ API5 Description: Register and/or login WordPress/BuddyPress users via their Google+ Account utilizing the Google+ API. 6 6 Author: Brian Messenlehner of WebDevStudios.com 7 7 Author URI: http://webdevstudios.com … … 9 9 */ 10 10 11 //check for buddypress 12 add_action( 'bp_include', 'wds_google_connect_buddypress' ); 13 function wds_google_connect_buddypress() { 14 require( dirname( __FILE__ ) . '/buddypress.php' ); 15 } 16 17 //Google+ Auth and Button 11 18 add_action('init', 'wds_google_connect_button'); 12 19 function wds_google_connect_button($button=false){ … … 65 72 } 66 73 $gplus_displayName=$me['displayName']; 74 $gplus_photo=$me['image']['url']; 67 75 if($gplus_id){ 68 76 if($user_ID!=0){//if already logged into wp account but want to link with g+ … … 76 84 if(!$user_id){ 77 85 $new_user=true; 78 $user_name=sanitize_user( $gplus_displayName ); 86 $user_name=$gplus_displayName; 87 $arr_user_name=explode(" ",$user_name); 88 $user_name=$arr_user_name[0];//user first name 89 $user_name=sanitize_user( $user_name ); 79 90 $user_name=str_replace(array(" ","."),"",$user_name); 80 91 $user = username_exists( $user_name ); 92 if ( $user ) { //try last name 93 $user_name=$arr_user_name[1]; 94 $user_name=sanitize_user( $user_name ); 95 $user_name=str_replace(array(" ","."),"",$user_name); 96 $user = username_exists( $user_name ); 97 } 98 if ( $user ) { //try first & last name 99 $user_name=$gplus_displayName; 100 $user_name=sanitize_user( $user_name ); 101 $user_name=str_replace(array(" ","."),"",$user_name); 102 $user = username_exists( $user_name ); 103 } 81 104 if ( $user ) { //if username happens to exsit tie a random 3 digit number to the end 105 $user_name=$arr_user_name[0]; 106 $user_name=sanitize_user( $user_name ); 107 $user_name=str_replace(array(" ","."),"",$user_name); 82 108 $user_name=$user_name.rand(100, 999); 83 109 $user = username_exists( $user_name ); … … 93 119 update_user_meta($user_id, 'nickname', $gplus_displayName); 94 120 update_user_meta($user_id, 'display_name', $gplus_displayName); 121 //budypress functions 122 if(function_exists('wds_bp_check')){ 123 wds_google_connect_bp_user($user_id,$gplus_displayName,$gplus_photo);//buddypress.php 124 } 95 125 } 96 126 update_user_meta($user_id, 'wds_google_connect_user_id', $gplus_id); … … 117 147 if ($button==true) { 118 148 if (!$client->getAccessToken()) { 119 $state = mt_rand(); 149 if($_SESSION['state']){ 150 $state=$_SESSION['state']; 151 }else{ 152 $state = mt_rand(); 153 } 120 154 $client->setState($state); 121 155 $_SESSION['state'] = $state; … … 158 192 register_setting( 'wds_google_connect_settings_group', 'wds_google_connect_redirect_url' ); 159 193 register_setting( 'wds_google_connect_settings_group', 'wds_google_connect_developer_key' ); 194 //buddypress 195 register_setting( 'wds_google_connect_settings_bp', 'wds_google_connect_bp_login' ); 196 register_setting( 'wds_google_connect_settings_bp', 'wds_google_connect_bp_profile' ); 197 register_setting( 'wds_google_connect_settings_bp', 'wds_google_connect_bp_registration' ); 198 register_setting( 'wds_google_connect_settings_bp', 'wds_google_connect_bp_required' ); 199 register_setting( 'wds_google_connect_settings_bp', 'wds_google_connect_bp_activity' ); 160 200 } 161 201 … … 177 217 <div class="icon32" id="icon-options-general"><br /></div> 178 218 <h2>Google+ Connect Settings</h2> 179 <ul> 180 <li>Visit the <a rel="nofollow" target="_blank" href="https://code.google.com/apis/console/?api=plus">Google API Console</a> to generate your developer key, OAuth2 client id, OAuth2 client secret, and register your OAuth2 redirect uri. </li> 181 <li>Click on "Services" in the left column and turn on "Google+ API".</li> 182 <li>Click on "API Access" in the left column and click the button labeled "Create an OAuth2 client ID" </li> 183 <li>Give your application a name and click "Next" </li> 184 <li>Select "Web Application" as the "Application type" </li> 185 <li>Click on (more options and enter <?php echo site_url();?> into each textarea box)</li> 186 <li>Click "Create client ID" </li> 187 <li>Fill in the fields below with the generated information</li> 188 </ul> 189 <form method="post" action="options.php"> 190 <table class="form-table"> 191 <?php settings_fields( 'wds_google_connect_settings_group' );?> 192 <tr valign="top"> 193 <th scope="row">Product Name:</th> 194 <td><input type="text" name="wds_google_connect_app_name" value="<?php echo $wds_google_connect_app_name; ?>" size="75" /></td> 195 </tr> 196 <tr valign="top"> 197 <th scope="row">Client ID:</th> 198 <td><input type="text" name="wds_google_connect_client_id" value="<?php echo $wds_google_connect_client_id; ?>" size="75" /></td> 199 </tr> 200 <tr valign="top"> 201 <th scope="row">Client Secret:</th> 202 <td><input type="text" name="wds_google_connect_client_secret" value="<?php echo $wds_google_connect_client_secret; ?>" size="75" /></td> 203 </tr> 204 <tr valign="top"> 205 <th scope="row">Redirect URI:</th> 206 <td><input type="text" name="wds_google_connect_redirect_url" value="<?php echo $wds_google_connect_redirect_url; ?>" size="75" /></td> 207 </tr> 208 <tr valign="top"> 209 <th scope="row">API Key:</th> 210 <td><input type="text" name="wds_google_connect_developer_key" value="<?php echo $wds_google_connect_developer_key; ?>" size="75" /></td> 211 </tr> 212 </table> 213 <p class="submit"> 214 <input type="submit" class="button-primary" value="Save Settings" /> 215 </p> 216 </form> 217 <h2>Google+ Login Button</h2> 218 <img title='Google+ Connect!' src='<?php echo plugins_url('gplus-button.png',__FILE__);?>'><br /> 219 <strong>Button Short Code:</strong> [gplus_button]<br /> 220 <strong>PHP Function:</strong> <?php wp_gplus_login_button();?><br /><br /> 221 219 <br /> 220 <?php $view=$_GET['view']; 221 if(function_exists('wds_bp_check') && 1==2){?> 222 <a <?php if($view==""){echo "style='font-weight:bold;'";}?> href="<?php echo add_query_arg( array ( 'view' => '' ) );?>">API Configuration</a> | 223 <a <?php if($view=="bp"){echo "style='font-weight:bold;'";}?> href="<?php echo add_query_arg( array ( 'view' => 'bp' ) );?>">BuddyPress Settings</a> 224 <br /><br /> 225 <?php } 226 if($view==""){?> 227 <ul> 228 <li>Visit the <a rel="nofollow" target="_blank" href="https://code.google.com/apis/console/?api=plus">Google API Console</a> to generate your developer key, OAuth2 client id, OAuth2 client secret, and register your OAuth2 redirect uri. </li> 229 <li>Click on "Services" in the left column and turn on "Google+ API".</li> 230 <li>Click on "API Access" in the left column and click the button labeled "Create an OAuth2 client ID" </li> 231 <li>Give your application a name and click "Next" </li> 232 <li>Select "Web Application" as the "Application type" </li> 233 <li>Click on (more options and enter <?php echo site_url();?> into each textarea box)</li> 234 <li>Click "Create client ID" </li> 235 <li>Fill in the fields below with the generated information</li> 236 </ul> 237 <?php } ?> 238 <form method="post" action="options.php"> 239 <table class="form-table"> 240 <?php if($view==""){?> 241 <?php settings_fields( 'wds_google_connect_settings_group' );?> 242 <tr valign="top"> 243 <th>Product Name:</th> 244 <td><input type="text" name="wds_google_connect_app_name" value="<?php echo $wds_google_connect_app_name; ?>" size="75" /></td> 245 </tr> 246 <tr valign="top"> 247 <th>Client ID:</th> 248 <td><input type="text" name="wds_google_connect_client_id" value="<?php echo $wds_google_connect_client_id; ?>" size="75" /></td> 249 </tr> 250 <tr valign="top"> 251 <th>Client Secret:</th> 252 <td><input type="text" name="wds_google_connect_client_secret" value="<?php echo $wds_google_connect_client_secret; ?>" size="75" /></td> 253 </tr> 254 <tr valign="top"> 255 <th>Redirect URI:</th> 256 <td><input type="text" name="wds_google_connect_redirect_url" value="<?php echo $wds_google_connect_redirect_url; ?>" size="75" /></td> 257 </tr> 258 <tr valign="top"> 259 <th>API Key:</th> 260 <td><input type="text" name="wds_google_connect_developer_key" value="<?php echo $wds_google_connect_developer_key; ?>" size="75" /></td> 261 </tr> 262 <?php }elseif($view=="bp"){ 263 $wds_google_connect_bp_login=esc_attr(get_option('wds_google_connect_bp_login')); 264 if($wds_google_connect_bp_login){ 265 $wds_google_connect_bp_login="checked"; 266 } 267 $wds_google_connect_bp_profile=esc_attr(get_option('wds_google_connect_bp_profile')); 268 if($wds_google_connect_bp_profile){ 269 $wds_google_connect_bp_profile="checked"; 270 } 271 $wds_google_connect_bp_registration=esc_attr(get_option('wds_google_connect_bp_registration')); 272 if($wds_google_connect_bp_registration){ 273 $wds_google_connect_bp_registration="checked"; 274 } 275 $wds_google_connect_bp_required=esc_attr(get_option('wds_google_connect_bp_required')); 276 if($wds_google_connect_bp_required){ 277 $wds_google_connect_bp_required="checked"; 278 } 279 $wds_google_connect_bp_activity=esc_attr(get_option('wds_google_connect_bp_activity')); 280 if($wds_google_connect_bp_activity){ 281 $wds_google_connect_bp_activity="checked"; 282 } 283 settings_fields( 'wds_google_connect_settings_bp' );?> 284 <tr valign="top"> 285 <td> 286 <input type="checkbox" name="wds_google_connect_bp_login" value="1" <?php echo $wds_google_connect_bp_login;?> /> 287 Add Google+ login button to BuddyPress sidebar login 288 </td> 289 </tr> 290 <tr valign="top"> 291 <td> 292 <input type="checkbox" name="wds_google_connect_bp_profile" value="1" <?php echo $wds_google_connect_bp_profile;?> /> 293 Add Google+ login button to logged in members profile 294 </td> 295 </tr> 296 <tr valign="top"> 297 <td> 298 <input type="checkbox" name="wds_google_connect_bp_registration" value="1" <?php echo $wds_google_connect_bp_registration;?> /> 299 Add Google+ login button to BuddyPress registration page 300 </td> 301 </tr> 302 <tr valign="top"> 303 <td> 304 <input type="checkbox" name="wds_google_connect_bp_required" value="1" <?php echo $wds_google_connect_bp_required;?> /> 305 Require Google+ connected members to fill out required BuddyPress profile fields 306 </td> 307 </tr> 308 <tr valign="top"> 309 <td> 310 <input type="checkbox" name="wds_google_connect_bp_activity" value="1" <?php echo $wds_google_connect_bp_activity;?> /> 311 Allow members to import their Google+ activity as BuddyPress activity 312 </td> 313 </tr> 314 <?php } ?> 315 </table> 316 <p class="submit"> 317 <input type="submit" class="button-primary" value="Save Settings" /> 318 </p> 319 </form> 320 <h2>Google+ Login Button</h2> 321 <img title='Google+ Connect!' src='<?php echo plugins_url('gplus-button.png',__FILE__);?>'><br /> 322 <strong>Button Short Code:</strong> [gplus_button]<br /> 323 <strong>PHP Function:</strong> <?php wp_gplus_login_button();?><br /><br /> 324 222 325 For support please visit the <a target="_blank" href="http://webdevstudios.com/support/forum/wp-google-plus-connect/">WP Google+ Connect Plugin Support Forum</a> | Version by <a target="_blank" href="http://webdevstudios.com">WebDevStudios.com</a><br /> 223 326
Note: See TracChangeset
for help on using the changeset viewer.