Social Login - Version 1.4

Version Description

  • Social Network Avatars can be displayed in comments
  • Social Login can be disabled below the login form
  • Social Login can be disabled below the registration form
  • Select redirection target after login
  • Select redirection target after registration
  • Enable account linking
Download this release

Release Info

Developer ClaudeSchlesser
Plugin Icon 128x128 Social Login
Version 1.4
Comparing to
See all releases

Code changes from version 1.3.5 to 1.4

assets/css/admin.css CHANGED
@@ -7,6 +7,28 @@
7
  width: 628px;
8
  }
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  .oa_container.oa_container_welcome {
11
  background-color: #E1EDFF
12
  }
@@ -29,6 +51,10 @@
29
  margin-bottom: 10px;
30
  }
31
 
 
 
 
 
32
  .oa_form_table .head {
33
  font-weight: bold;
34
  font-size: 13px;
@@ -42,14 +68,22 @@
42
  text-align: center;
43
  }
44
 
45
- .oa_form_table .foot .error_message{
46
- color:red;
47
- font-weight:bold;
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
- .oa_form_table .foot .success_message{
51
- color:green;
52
- font-weight:bold;
53
  }
54
 
55
  .oa_form_table .row_even {
@@ -126,4 +160,14 @@
126
 
127
  .oa_provider.oa_provider_vkontakte {
128
  background-position: 111px -1px;
 
 
 
 
 
 
 
 
 
 
129
  }
7
  width: 628px;
8
  }
9
 
10
+ .oa_container h3 {
11
+ margin: 0 0 10px 0;
12
+ }
13
+
14
+ .oa_container ul {
15
+ list-style-type: disc;
16
+ padding-left: 20px;
17
+ }
18
+
19
+ .oa_container.oa_container_links {
20
+ background-color: #FFFFE0;
21
+ border-color: #E6DB55;
22
+ }
23
+
24
+ .oa_container.oa_container_links a {
25
+ color: #111;
26
+ }
27
+
28
+ .oa_container.oa_container_links a:hover {
29
+ color: #d54e21;
30
+ }
31
+
32
  .oa_container.oa_container_welcome {
33
  background-color: #E1EDFF
34
  }
51
  margin-bottom: 10px;
52
  }
53
 
54
+ .oa_form_table input {
55
+ border-color: #aaa;
56
+ }
57
+
58
  .oa_form_table .head {
59
  font-weight: bold;
60
  font-size: 13px;
68
  text-align: center;
69
  }
70
 
71
+ .oa_form_table .foot .error_message {
72
+ color: red;
73
+ font-weight: bold;
74
+ }
75
+
76
+ .oa_form_table .foot .success_message {
77
+ color: green;
78
+ font-weight: bold;
79
+ }
80
+
81
+ .oa_form_table tr td.row {
82
+ line-height: 36px;
83
  }
84
 
85
+ .oa_form_table tr.description td {
86
+ color: #0D5995;
 
87
  }
88
 
89
  .oa_form_table .row_even {
160
 
161
  .oa_provider.oa_provider_vkontakte {
162
  background-position: 111px -1px;
163
+ }
164
+
165
+ .oa_form_table_settings tr.row_odd,.oa_form_table_settings tr.row_odd td {
166
+ background-color: #e7e7e7;
167
+ color: #222;
168
+ font-weight: bold;
169
+ }
170
+
171
+ .oa_form_table_settings .row_even {
172
+ border-bottom: 1px dotted #BBBBBB;
173
  }
includes/admin.php CHANGED
@@ -144,7 +144,18 @@ function oa_social_login_settings_validate ($settings)
144
  'api_subdomain',
145
  'api_key',
146
  'api_secret',
147
- 'plugin_caption'
 
 
 
 
 
 
 
 
 
 
 
148
  ) AS $key)
149
  {
150
  if (isset ($settings [$key]))
@@ -172,6 +183,41 @@ function oa_social_login_settings_validate ($settings)
172
  }
173
  }
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  //Done
176
  return $sanitzed_settings;
177
  }
@@ -202,15 +248,11 @@ function oa_display_social_login_settings ()
202
  </p>
203
  <p>
204
  To be able to use this plugin you first of all need to create a free account at <a href="https://app.oneall.com/signup/" target="_blank">http://www.oneall.com</a>
205
- and create a new Site. After having created your account and setup your Site, please enter the Site Settings in the form below.
206
  </p>
 
207
  <p>
208
- Feel free to <a href="http://www.oneall.com/company/contact-us/" target="_blank">contact us</a> if you need any help with the integration of this plugin!
209
- We are devoted to creating a positive experience for our users. If anything is unclear, please get in touch!
210
- </p>
211
- <h3>The basic account creation is free and the setup is easy!</h3>
212
- <p>
213
- <a class="button-secondary" href="https://app.oneall.com/signup/" target="_blank"><strong>Setup my account now</strong></a>
214
  </p>
215
  </div>
216
  </div>
@@ -225,12 +267,8 @@ function oa_display_social_login_settings ()
225
  </h3>
226
  <div class="oa_container_body">
227
  <p>
228
- Login to your account to manage your providers and access your <a href="http://www.oneall.com/services/social-insights/" target="_blank">Social Insights</a>.
229
- Determine which social networks are popular amongst your users and tailor your registration experience to increase your users' engagement
230
- </p>
231
- <p>
232
- Feel free to <a href="http://www.oneall.com/company/contact-us/" target="_blank">contact us</a> if you need any help with the integration of this plugin!
233
- We are devoted to creating a positive experience for our users. If anything is unclear, please get in touch!
234
  </p>
235
  <p>
236
  <a class="button-secondary" href="https://app.oneall.com/signin/" target="_blank"><strong>Signin to my account</strong></a>
@@ -240,6 +278,16 @@ function oa_display_social_login_settings ()
240
  <?php
241
  }
242
  ?>
 
 
 
 
 
 
 
 
 
 
243
  <form method="post" action="options.php">
244
  <?php
245
  settings_fields ('oa_social_login_settings_group');
@@ -296,30 +344,138 @@ function oa_display_social_login_settings ()
296
  foreach ($oa_social_login_providers AS $key => $name)
297
  {
298
  ?>
299
- <tr class="<?php echo ((($i++) % 2) == 0) ? 'row_even' : 'row_odd)' ?> row_provider">
300
- <th scope="row">
301
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><span class="oa_provider oa_provider_<?php echo $key; ?>" title="<?php echo htmlspecialchars ($name); ?>"><?php echo htmlspecialchars ($name); ?></span></label>
302
  <input type="checkbox" id="oneall_social_login_provider_<?php echo $key; ?>" name="oa_social_login_settings[providers][<?php echo $key; ?>]" value="1" <?php checked ('1', $settings ['providers'] [$key]); ?> />
303
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><?php echo htmlspecialchars ($name); ?></label>
304
- </th>
305
  </tr>
306
  <?php
307
  }
308
  ?>
309
  </table>
310
 
311
- <table class="form-table oa_form_table">
312
  <tr>
313
- <th class="head" colspan="2">
314
- <?php _e('Settings', 'oa_social_login'); ?>
315
  </th>
316
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  <tr>
318
- <th scope="row">
319
- <label for="oneall_api_private_key"><?php _e('Social Login Caption', 'oa_social_login'); ?>:</label>
320
- </th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  <td>
322
- <input type="text" id="oa_social_login_settings_plugin_caption" name="oa_social_login_settings[plugin_caption]" size="60" value="<?php echo (isset ($settings ['plugin_caption']) ? htmlspecialchars ($settings ['plugin_caption']) : _e('Connect with:')); ?>" />
 
 
 
 
 
 
323
  </td>
324
  </tr>
325
  </table>
144
  'api_subdomain',
145
  'api_key',
146
  'api_secret',
147
+ 'plugin_caption',
148
+
149
+ 'plugin_link_verified_accounts',
150
+ 'plugin_show_avatars_in_comments',
151
+
152
+ 'plugin_display_in_login_form',
153
+ 'plugin_login_form_redirect',
154
+ 'plugin_login_form_redirect_custom_url',
155
+
156
+ 'plugin_display_in_registration_form',
157
+ 'plugin_registration_form_redirect',
158
+ 'plugin_registration_form_redirect_custom_url'
159
  ) AS $key)
160
  {
161
  if (isset ($settings [$key]))
183
  }
184
  }
185
 
186
+
187
+ //Flag settings
188
+ $sanitzed_settings['plugin_show_avatars_in_comments'] == ((isset ($sanitzed_settings['plugin_show_avatars_in_comments']) AND $sanitzed_settings['plugin_show_avatars_in_comments'] == '1') ? 1 : 0);
189
+ $sanitzed_settings['plugin_link_verified_accounts'] == ((isset ($sanitzed_settings['plugin_link_verified_accounts']) AND $sanitzed_settings['plugin_link_verified_accounts'] == '0') ? 0 : 1);
190
+ $sanitzed_settings['plugin_login_form_redirect'] = ((isset ($sanitzed_settings ['plugin_login_form_redirect']) AND in_array ($sanitzed_settings ['plugin_login_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? $sanitzed_settings ['plugin_login_form_redirect'] : 'homepage');
191
+ $sanitzed_settings['plugin_registration_form_redirect'] = ((isset ($sanitzed_settings ['plugin_registration_form_redirect']) AND in_array ($sanitzed_settings ['plugin_registration_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? $sanitzed_settings ['plugin_registration_form_redirect'] : 'dashboard');
192
+ $sanitzed_settings['plugin_display_in_login_form'] == ((isset ($sanitzed_settings['plugin_display_in_login_form']) AND $sanitzed_settings['plugin_display_in_login_form'] == '0') ? 0 : 1);
193
+
194
+ //Check Login Redirection Settings
195
+ if ($sanitzed_settings['plugin_login_form_redirect'] == 'custom')
196
+ {
197
+ if (empty ($sanitzed_settings['plugin_login_form_redirect_custom_url']))
198
+ {
199
+ $sanitzed_settings['plugin_login_form_redirect'] = 'homepage';
200
+ }
201
+ }
202
+ else
203
+ {
204
+ $sanitzed_settings['plugin_login_form_redirect_custom_url'] = '';
205
+ }
206
+
207
+
208
+ //Check Registration Redirection Settings
209
+ if ($sanitzed_settings['plugin_registration_form_redirect'] == 'custom')
210
+ {
211
+ if (empty ($sanitzed_settings['plugin_registration_form_redirect_custom_url']))
212
+ {
213
+ $sanitzed_settings['plugin_registration_form_redirect'] = 'dashboard';
214
+ }
215
+ }
216
+ else
217
+ {
218
+ $sanitzed_settings['plugin_registration_form_redirect_custom_url'] = '';
219
+ }
220
+
221
  //Done
222
  return $sanitzed_settings;
223
  }
248
  </p>
249
  <p>
250
  To be able to use this plugin you first of all need to create a free account at <a href="https://app.oneall.com/signup/" target="_blank">http://www.oneall.com</a>
251
+ and setup a Site. After having created your account and setup your Site, please enter the Site settings in the form below.
252
  </p>
253
+ <h3>The account creation is free and takes only a couple of minutes!</h3>
254
  <p>
255
+ <a class="button-secondary" href="https://app.oneall.com/signup/" target="_blank"><strong>Setup my free account now</strong></a>
 
 
 
 
 
256
  </p>
257
  </div>
258
  </div>
267
  </h3>
268
  <div class="oa_container_body">
269
  <p>
270
+ <a href="https://app.oneall.com/signin/" target="_blank">Login to your account</a> to manage your providers and access your <a href="https://app.oneall.com/insights/" target="_blank">Social Insights</a>.
271
+ Determine which social networks are popular amongst your users and tailor your registration experience to increase your users' engagement.
 
 
 
 
272
  </p>
273
  <p>
274
  <a class="button-secondary" href="https://app.oneall.com/signin/" target="_blank"><strong>Signin to my account</strong></a>
278
  <?php
279
  }
280
  ?>
281
+ <div class="oa_container oa_container_links">
282
+ <h3>
283
+ Help, Updates &amp; Documentation
284
+ </h3>
285
+ <ul>
286
+ <li><a target="_blank" href="http://www.twitter.com/oneall">Follow us on Twitter</a> to stay informed about updates;</li>
287
+ <li><a target="_blank" href="http://docs.oneall.com/plugins/guide/social-login-wordpress/">Read the online documentation</a> for more information about this plugin;</li>
288
+ <li><a target="_blank" href="http://www.oneall.com/company/contact-us/">Contact us</a> if you have feedback or need assistance.</li>
289
+ </ul>
290
+ </div>
291
  <form method="post" action="options.php">
292
  <?php
293
  settings_fields ('oa_social_login_settings_group');
344
  foreach ($oa_social_login_providers AS $key => $name)
345
  {
346
  ?>
347
+ <tr class="<?php echo ((($i++) % 2) == 0) ? 'row_even' : 'row_odd' ?> row_provider">
348
+ <td class="row">
349
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><span class="oa_provider oa_provider_<?php echo $key; ?>" title="<?php echo htmlspecialchars ($name); ?>"><?php echo htmlspecialchars ($name); ?></span></label>
350
  <input type="checkbox" id="oneall_social_login_provider_<?php echo $key; ?>" name="oa_social_login_settings[providers][<?php echo $key; ?>]" value="1" <?php checked ('1', $settings ['providers'] [$key]); ?> />
351
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><?php echo htmlspecialchars ($name); ?></label>
352
+ </td>
353
  </tr>
354
  <?php
355
  }
356
  ?>
357
  </table>
358
 
359
+ <table class="form-table oa_form_table oa_form_table_settings">
360
  <tr>
361
+ <th class="head">
362
+ <?php _e('Basic Settings', 'oa_social_login'); ?>
363
  </th>
364
  </tr>
365
+
366
+ <tr class="row_odd">
367
+ <td>
368
+ <?php _e('Enter the caption to be displayed above the social network login buttons:', 'oa_social_login'); ?>
369
+ </td>
370
+ </tr>
371
+ <tr class="row_even">
372
+ <td>
373
+ <input type="text" name="oa_social_login_settings[plugin_caption]" size="118" value="<?php echo (isset ($settings ['plugin_caption']) ? htmlspecialchars ($settings ['plugin_caption']) : _e('Connect with:')); ?>" />
374
+ </td>
375
+ </tr>
376
+
377
+ <tr class="row_odd">
378
+ <td>
379
+ <?php _e("If the user's social network profile has an avatar thumbnail, should we show it beside his comments?" , 'oa_social_login'); ?>
380
+ </td>
381
+ </tr>
382
+ <tr class="row_even">
383
+ <td>
384
+ <?php
385
+ $plugin_show_avatars_in_comments = (isset ($settings ['plugin_show_avatars_in_comments']) AND $settings ['plugin_show_avatars_in_comments'] == '1');
386
+ ?>
387
+ <input type="radio" name="oa_social_login_settings[plugin_show_avatars_in_comments]" value="1" <?php echo ($plugin_show_avatars_in_comments ? 'checked="checked"' : '');?> /> <?php _e('Yes, show user avatars from social networks if available');?><br />
388
+ <input type="radio" name="oa_social_login_settings[plugin_show_avatars_in_comments]" value="0" <?php echo ( ! $plugin_show_avatars_in_comments ? 'checked="checked"' : '');?> /> <?php _e('No, display the default avatars');?> <strong>(<?php _e('Default')?>)</strong>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ <table class="form-table oa_form_table oa_form_table_settings">
393
  <tr>
394
+ <th class="head">
395
+ <?php _e('Login Settings', 'oa_social_login'); ?>
396
+ </th>
397
+ </tr>
398
+ <tr class="row_odd">
399
+ <td>
400
+ <?php _e('Do you want to display the social network login buttons below the login form of your blog?', 'oa_social_login'); ?>
401
+ </td>
402
+ </tr>
403
+ <tr class="row_even">
404
+ <td>
405
+ <?php
406
+ $plugin_display_in_login_form = ( ! isset ($settings ['plugin_display_in_login_form']) OR $settings ['plugin_display_in_login_form'] == '1');
407
+ ?>
408
+ <input type="radio" name="oa_social_login_settings[plugin_display_in_login_form]" value="1" <?php echo ($plugin_display_in_login_form ? 'checked="checked"' : '');?> /> <?php _e('Yes, display the social network buttons below the login form');?> <strong>(<?php _e('Default')?>)</strong><br />
409
+ <input type="radio" name="oa_social_login_settings[plugin_display_in_login_form]" value="0" <?php echo (! $plugin_display_in_login_form ? 'checked="checked"' : '');?> /> <?php _e('No, disable social network buttons in the login form');?>
410
+ </td>
411
+ </tr>
412
+
413
+ <tr class="row_odd">
414
+ <td>
415
+ <?php _e('Where should existent users be redirected to after having logged in with their social network account?', 'oa_social_login'); ?>
416
+ </td>
417
+ </tr>
418
+ <tr class="row_even">
419
+ <td>
420
+ <?php
421
+ $plugin_login_form_redirect = ((! isset ($settings ['plugin_login_form_redirect']) OR ! in_array ($settings ['plugin_login_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? 'homepage' : $settings ['plugin_login_form_redirect']);
422
+ ?>
423
+ <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="homepage" <?php echo ($plugin_login_form_redirect == 'homepage' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to the homepage of my blog');?> <strong>(<?php _e('Default')?>)</strong><br />
424
+ <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="dashboard" <?php echo ($plugin_login_form_redirect == 'dashboard' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to their account dashboard'); ?><br />
425
+ <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="custom" <?php echo ($plugin_login_form_redirect == 'custom' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to the following url:');?><br />
426
+ <input type="text" name="oa_social_login_settings[plugin_login_form_redirect_custom_url]" size="118" value="<?php echo (isset ($settings ['plugin_login_form_redirect_custom_url']) ? htmlspecialchars ($settings ['plugin_login_form_redirect_custom_url']) : ''); ?>" />
427
+ </td>
428
+ </tr>
429
+ </table>
430
+ <table class="form-table oa_form_table oa_form_table_settings">
431
+ <tr>
432
+ <th class="head">
433
+ <?php _e('Registration Settings', 'oa_social_login'); ?>
434
+ </th>
435
+ </tr>
436
+ <tr class="row_odd">
437
+ <td>
438
+ <?php _e('If the email address of the social network profile is verified, should we try to link it to an existing account?', 'oa_social_login'); ?>
439
+ </td>
440
+ </tr>
441
+ <tr class="row_even">
442
+ <td>
443
+ <?php
444
+ $plugin_link_verified_accounts = ( ! isset ($settings ['plugin_link_verified_accounts']) OR $settings ['plugin_link_verified_accounts'] == '1');
445
+ ?>
446
+ <input type="radio" name="oa_social_login_settings[plugin_link_verified_accounts]" value="1" <?php echo ($plugin_link_verified_accounts ? 'checked="checked"' : '');?> /> <?php _e('Yes, try to link verified social network profiles to existing blog accounts');?> <strong>(<?php _e('Default')?>)</strong><br />
447
+ <input type="radio" name="oa_social_login_settings[plugin_link_verified_accounts]" value="0" <?php echo ( ! $plugin_link_verified_accounts ? 'checked="checked"' : '');?> /> <?php _e('No, disable account linking');?>
448
+ </td>
449
+ </tr>
450
+ <tr class="row_odd">
451
+ <td>
452
+ <?php _e('Do you want to display the social network login buttons below the registration form of your blog?', 'oa_social_login'); ?>
453
+ </td>
454
+ </tr>
455
+ <tr class="row_even">
456
+ <td>
457
+ <?php
458
+ $plugin_display_in_registration_form = ( ! isset ($settings ['plugin_display_in_registration_form']) OR $settings ['plugin_display_in_registration_form'] == '1');
459
+ ?>
460
+ <input type="radio" name="oa_social_login_settings[plugin_display_in_registration_form]" value="1" <?php echo ($plugin_display_in_registration_form ? 'checked="checked"' : '');?> /> <?php _e('Yes, display the social network buttons below the registration form');?> <strong>(<?php _e('Default')?>)</strong><br />
461
+ <input type="radio" name="oa_social_login_settings[plugin_display_in_registration_form]" value="0" <?php echo (! $plugin_display_in_registration_form ? 'checked="checked"' : '');?> /> <?php _e('No, disable social network buttons in the registration form');?>
462
+ </td>
463
+ </tr>
464
+
465
+ <tr class="row_odd">
466
+ <td>
467
+ <?php _e('Where should new users be redirected to after having registered with their social network account?', 'oa_social_login'); ?>
468
+ </td>
469
+ </tr>
470
+ <tr class="row_even">
471
  <td>
472
+ <?php
473
+ $plugin_registration_form_redirect = ((! isset ($settings ['plugin_registration_form_redirect']) OR ! in_array ($settings ['plugin_registration_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? 'dashboard' : $settings ['plugin_registration_form_redirect']);
474
+ ?>
475
+ <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="homepage" <?php echo ($plugin_registration_form_redirect == 'homepage' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to the homepage of my blog');?><br />
476
+ <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="dashboard" <?php echo ($plugin_registration_form_redirect == 'dashboard' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to their account dashboard'); ?> <strong>(<?php _e('Default')?>)</strong><br />
477
+ <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="custom" <?php echo ($plugin_registration_form_redirect == 'custom' ? 'checked="checked"' : '');?> /> <?php _e('Redirect users to the following url:');?><br />
478
+ <input type="text" name="oa_social_login_settings[plugin_registration_form_redirect_custom_url]" size="118" value="<?php echo (isset ($settings ['plugin_registration_form_redirect_custom_url']) ? htmlspecialchars ($settings ['plugin_registration_form_redirect_custom_url']) : ''); ?>" />
479
  </td>
480
  </tr>
481
  </table>
includes/toolbox.php CHANGED
@@ -99,9 +99,19 @@ function oa_social_login_callback ()
99
  foreach ($identity->emails AS $email)
100
  {
101
  $user_email = $email->value;
 
102
  }
103
  }
104
 
 
 
 
 
 
 
 
 
 
105
  //User Website
106
  $user_website = '';
107
  if ( ! empty ($identity->profileUrl))
@@ -131,6 +141,37 @@ function oa_social_login_callback ()
131
  // Get user by token
132
  $user_id = oa_social_login_get_user_by_token ($user_token);
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  //New User
135
  if ( ! is_numeric ($user_id))
136
  {
@@ -148,7 +189,7 @@ function oa_social_login_callback ()
148
  do
149
  {
150
  $user_login_tmp = $user_login.($i++);
151
- } while (username_exists ($user_login_tmp));
152
  $user_login = $user_login_tmp;
153
  }
154
 
@@ -175,6 +216,11 @@ function oa_social_login_callback ()
175
  update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
176
  update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
177
  update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
 
 
 
 
 
178
  }
179
  }
180
 
@@ -187,7 +233,91 @@ function oa_social_login_callback ()
187
  //Redirect to administration area
188
  if (! empty ($_REQUEST['oa_social_login_source']) AND in_array ($_REQUEST['oa_social_login_source'], array ('login', 'registration')))
189
  {
190
- wp_safe_redirect(admin_url());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  exit();
192
  }
193
  //Set current user
99
  foreach ($identity->emails AS $email)
100
  {
101
  $user_email = $email->value;
102
+ $user_email_is_verified = ($email->is_verified == '1');
103
  }
104
  }
105
 
106
+ //Thumbnail
107
+ $user_thumbnail = '';
108
+ if ( ! empty ($identity->thumbnailUrl))
109
+ {
110
+ $user_thumbnail = trim ($identity->thumbnailUrl);
111
+ }
112
+
113
+
114
+
115
  //User Website
116
  $user_website = '';
117
  if ( ! empty ($identity->profileUrl))
141
  // Get user by token
142
  $user_id = oa_social_login_get_user_by_token ($user_token);
143
 
144
+ //Try to link to existing account
145
+ if ( ! is_numeric ($user_id))
146
+ {
147
+ //Linked enabled?
148
+ if ( ! isset($settings['plugin_link_verified_accounts']) OR $settings['plugin_link_verified_accounts'] == '1')
149
+ {
150
+ //Only of email is verified
151
+ if ( ! empty ($user_email) AND $user_email_is_verified === true)
152
+ {
153
+ //Read existing user
154
+ if (($user_id_tmp = email_exists($user_email)) !== false)
155
+ {
156
+ if (is_numeric ($user_id_tmp))
157
+ {
158
+ $user_id = $user_id_tmp;
159
+ delete_metadata('user', null, 'oa_social_login_user_token', $user_token, true);
160
+ update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
161
+ update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
162
+ update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
163
+
164
+ if ( ! empty ($user_thumbnail))
165
+ {
166
+ update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+
175
  //New User
176
  if ( ! is_numeric ($user_id))
177
  {
189
  do
190
  {
191
  $user_login_tmp = $user_login.($i++);
192
+ } while (username_exists ($user_login_tmp));
193
  $user_login = $user_login_tmp;
194
  }
195
 
216
  update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
217
  update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
218
  update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
219
+
220
+ if ( ! empty ($user_thumbnail))
221
+ {
222
+ update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
223
+ }
224
  }
225
  }
226
 
233
  //Redirect to administration area
234
  if (! empty ($_REQUEST['oa_social_login_source']) AND in_array ($_REQUEST['oa_social_login_source'], array ('login', 'registration')))
235
  {
236
+ //Registration
237
+ if ($_REQUEST['oa_social_login_source'] == 'registration')
238
+ {
239
+ //Default redirection
240
+ $redirect_to = admin_url();
241
+ $redirect_to_safe = false;
242
+
243
+ //Redirection customized
244
+ if (isset ($settings ['plugin_registration_form_redirect']))
245
+ {
246
+ switch (strtolower($settings ['plugin_registration_form_redirect']))
247
+ {
248
+ //Homepage
249
+ case 'homepage':
250
+ $redirect_to = site_url();
251
+ break;
252
+
253
+ //Custom
254
+ case 'custom':
255
+ if ( isset ($settings ['plugin_registration_form_redirect_custom_url']) AND strlen(trim($settings ['plugin_registration_form_redirect_custom_url'])) > 0)
256
+ {
257
+ $redirect_to = trim($settings ['plugin_registration_form_redirect_custom_url']);
258
+ }
259
+ break;
260
+
261
+ //Default/Dashboard
262
+ default:
263
+ case 'dashboard':
264
+ $redirect_to = admin_url();
265
+ break;
266
+ }
267
+ }
268
+ }
269
+ //Login
270
+ elseif ($_REQUEST['oa_social_login_source'] == 'login')
271
+ {
272
+ //Default redirection
273
+ $redirect_to = site_url();
274
+ $redirect_to_safe = false;
275
+
276
+ //Redirection in URL
277
+ if ( ! empty ($_GET['redirect_to']))
278
+ {
279
+ $redirect_to = $_GET['redirect_to'];
280
+ $redirect_to_safe = true;
281
+ }
282
+ else
283
+ {
284
+ //Redirection customized
285
+ if (isset ($settings ['plugin_login_form_redirect']))
286
+ {
287
+ switch (strtolower($settings ['plugin_login_form_redirect']))
288
+ {
289
+ //Dashboard
290
+ case 'dashboard':
291
+ $redirect_to = admin_url();
292
+ break;
293
+
294
+ //Custom
295
+ case 'custom':
296
+ if ( isset ($settings ['plugin_login_form_redirect_custom_url']) AND strlen(trim($settings ['plugin_login_form_redirect_custom_url'])) > 0)
297
+ {
298
+ $redirect_to = trim($settings ['plugin_login_form_redirect_custom_url']);
299
+ }
300
+ break;
301
+
302
+ //Default/Homepage
303
+ default:
304
+ case 'homepage':
305
+ $redirect_to = site_url();
306
+ break;
307
+ }
308
+ }
309
+ }
310
+ }
311
+
312
+ if ($redirect_to_safe)
313
+ {
314
+ wp_redirect($redirect_to);
315
+ }
316
+ else
317
+ {
318
+ wp_safe_redirect($redirect_to);
319
+ }
320
+
321
  exit();
322
  }
323
  //Set current user
includes/user_interface.php CHANGED
@@ -5,14 +5,14 @@
5
  **/
6
  function oa_social_login_add_javascripts ()
7
  {
8
- if ( ! wp_script_is ('oa_social_library', 'registered'))
9
  {
10
  //Read settings
11
  $settings = get_option ('oa_social_login_settings');
12
 
13
  if (!empty ($settings ['api_subdomain']))
14
  {
15
- wp_register_script ("oa_social_library", (is_ssl() ? 'https' : 'http').'://'.$settings ['api_subdomain'].'.api.oneall.com/socialize/library.js');
16
  }
17
  }
18
  wp_print_scripts ("oa_social_library");
@@ -21,7 +21,6 @@ add_action ('login_head', 'oa_social_login_add_javascripts');
21
  add_action ('wp_head', 'oa_social_login_add_javascripts');
22
 
23
 
24
-
25
  /**
26
  * Setup Shortcode handler
27
  **/
@@ -34,6 +33,41 @@ function oa_social_login_shortcode_handler ($args)
34
  }
35
  add_shortcode ('oa_social_login', 'oa_social_login_shortcode_handler');
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
 
39
  /**
@@ -49,27 +83,37 @@ function oa_social_login_render_login_form_comments ()
49
  add_action ('comment_form_top', 'oa_social_login_render_login_form_comments');
50
 
51
 
52
-
53
  /**
54
  * Display the provider grid for registration
55
  */
56
  function oa_social_login_render_login_form_registration ()
57
  {
58
- if (get_option('users_can_register') === '1')
 
59
  {
60
- oa_social_login_render_login_form ('registration');
 
 
 
 
 
 
 
61
  }
62
  }
63
  add_action ('register_form', 'oa_social_login_render_login_form_registration');
64
 
65
 
66
-
67
  /**
68
  * Display the provider grid for login
69
  */
70
  function oa_social_login_render_login_form_login ()
71
  {
72
- if (!is_user_logged_in ())
 
 
 
 
73
  {
74
  oa_social_login_render_login_form ('login');
75
  }
@@ -82,10 +126,7 @@ add_action ('login_form', 'oa_social_login_render_login_form_login');
82
  */
83
  function oa_social_login_render_custom_form_login ()
84
  {
85
- if (!is_user_logged_in ())
86
- {
87
- oa_social_login_render_login_form ('custom');
88
- }
89
  }
90
  add_action ('oa_social_login', 'oa_social_login_render_custom_form_login');
91
 
@@ -105,7 +146,7 @@ function oa_social_login_render_login_form ($source)
105
  $api_subdomain = (!empty ($settings ['api_subdomain']) ? $settings ['api_subdomain'] : '');
106
 
107
  //API Subdomain Required
108
- if ( ! empty ($api_subdomain))
109
  {
110
  //Caption
111
  $plugin_caption = (!empty ($settings ['plugin_caption']) ? $settings ['plugin_caption'] : '');
@@ -123,10 +164,6 @@ function oa_social_login_render_login_form ($source)
123
  }
124
  }
125
 
126
- //Grid Size
127
- $grid_size_x = 99;
128
- $grid_size_y = 99;
129
-
130
  //Widget
131
  if ($source == 'widget')
132
  {
@@ -138,25 +175,20 @@ function oa_social_login_render_login_form ($source)
138
  {
139
  //For all page, except the Widget
140
  $css_theme_uri = 'http://oneallcdn.com/css/api/socialize/themes/wp_inline.css';
141
- $show_title = (empty($plugin_caption ) ? false : true);
142
 
143
- //Comments
144
  if ($source == 'comments')
145
  {
146
  $source .= '#comments';
147
  }
148
- elseif (in_array($source, array ('login', 'registration')))
149
- {
150
- $grid_size_x = 5;
151
- $grid_size_y = 1;
152
- }
153
  }
154
 
155
  //Providers selected?
156
  if (count ($providers) > 0)
157
  {
158
  //Random integer
159
- $rand = mt_rand(99999, 9999999);
160
  ?>
161
  <div class="oneall_social_login">
162
  <?php
@@ -167,14 +199,12 @@ function oa_social_login_render_login_form ($source)
167
  <?php
168
  }
169
  ?>
170
- <div class="oneall_social_login_providers" id="oneall_social_login_providers_<?php echo $rand; ?>" style="margin-top:5px;margin-botom:5px"></div>
171
  <script type="text/javascript">
172
  oneall.api.plugins.social_login.build("oneall_social_login_providers_<?php echo $rand; ?>", {
173
- 'providers': ['<?php echo implode ("','", $providers); ?>'],
174
  'callback_uri': (window.location.href + ((window.location.href.split('?')[1] ? '&':'?') + 'oa_social_login_source=<?php echo $source; ?>')),
175
- 'css_theme_uri': '<?php echo $css_theme_uri; ?>',
176
- 'grid_size_x': '<?php echo $grid_size_x; ?>',
177
- 'grid_size_y': '<?php echo $grid_size_y; ?>'
178
  });
179
  </script>
180
  </div>
5
  **/
6
  function oa_social_login_add_javascripts ()
7
  {
8
+ if (!wp_script_is ('oa_social_library', 'registered'))
9
  {
10
  //Read settings
11
  $settings = get_option ('oa_social_login_settings');
12
 
13
  if (!empty ($settings ['api_subdomain']))
14
  {
15
+ wp_register_script ("oa_social_library", (is_ssl () ? 'https' : 'http') . '://' . $settings ['api_subdomain'] . '.api.oneall.com/socialize/library.js');
16
  }
17
  }
18
  wp_print_scripts ("oa_social_library");
21
  add_action ('wp_head', 'oa_social_login_add_javascripts');
22
 
23
 
 
24
  /**
25
  * Setup Shortcode handler
26
  **/
33
  }
34
  add_shortcode ('oa_social_login', 'oa_social_login_shortcode_handler');
35
 
36
+ /**
37
+ * Display custom avatars
38
+ */
39
+ function oa_social_login_custom_avatar ()
40
+ {
41
+ global $comment;
42
+ $args = func_get_args ();
43
+
44
+ //Check if we are in a comment
45
+ if (!is_null ($comment))
46
+ {
47
+ //Check required args and get author details
48
+ if (!empty ($args [0]) AND function_exists ('get_the_author_meta'))
49
+ {
50
+ //Read settings
51
+ $settings = get_option ('oa_social_login_settings');
52
+ if (isset($settings['plugin_show_avatars_in_comments']) AND $settings['plugin_show_avatars_in_comments'] == '1')
53
+ {
54
+ //Read Thumbnail
55
+ if (($user_thumbnail = get_the_author_meta ('oa_social_login_user_thumbnail')) !== null)
56
+ {
57
+ if (strlen (trim ($user_thumbnail)) > 0)
58
+ {
59
+ $user_thumbnail = preg_replace ('#src=([\'"])([^\\1]+)\\1#Ui', "src=\\1" . $user_thumbnail . "\\1", $args [0]);
60
+ $user_thumbnail = preg_replace ('#height=([\'"])([^\\1]+)\\1#Ui', "", $user_thumbnail);
61
+ $user_thumbnail = preg_replace ('#width=([\'"])([^\\1]+)\\1#Ui', "", $user_thumbnail);
62
+ return $user_thumbnail;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ return $args[0];
69
+ }
70
+ add_filter ('get_avatar', 'oa_social_login_custom_avatar');
71
 
72
 
73
  /**
83
  add_action ('comment_form_top', 'oa_social_login_render_login_form_comments');
84
 
85
 
 
86
  /**
87
  * Display the provider grid for registration
88
  */
89
  function oa_social_login_render_login_form_registration ()
90
  {
91
+ //Users may register
92
+ if (get_option ('users_can_register') === '1')
93
  {
94
+ //Read settings
95
+ $settings = get_option ('oa_social_login_settings');
96
+
97
+ //Display buttons if option not set or enabled
98
+ if (!isset ($settings ['plugin_display_in_registration_form']) OR $settings ['plugin_display_in_registration_form'] == '1')
99
+ {
100
+ oa_social_login_render_login_form ('registration');
101
+ }
102
  }
103
  }
104
  add_action ('register_form', 'oa_social_login_render_login_form_registration');
105
 
106
 
 
107
  /**
108
  * Display the provider grid for login
109
  */
110
  function oa_social_login_render_login_form_login ()
111
  {
112
+ //Read settings
113
+ $settings = get_option ('oa_social_login_settings');
114
+
115
+ //Display buttons if option not set or enabled
116
+ if (!isset ($settings ['plugin_display_in_login_form']) OR $settings ['plugin_display_in_login_form'] == '1')
117
  {
118
  oa_social_login_render_login_form ('login');
119
  }
126
  */
127
  function oa_social_login_render_custom_form_login ()
128
  {
129
+ oa_social_login_render_login_form ('custom');
 
 
 
130
  }
131
  add_action ('oa_social_login', 'oa_social_login_render_custom_form_login');
132
 
146
  $api_subdomain = (!empty ($settings ['api_subdomain']) ? $settings ['api_subdomain'] : '');
147
 
148
  //API Subdomain Required
149
+ if (!empty ($api_subdomain))
150
  {
151
  //Caption
152
  $plugin_caption = (!empty ($settings ['plugin_caption']) ? $settings ['plugin_caption'] : '');
164
  }
165
  }
166
 
 
 
 
 
167
  //Widget
168
  if ($source == 'widget')
169
  {
175
  {
176
  //For all page, except the Widget
177
  $css_theme_uri = 'http://oneallcdn.com/css/api/socialize/themes/wp_inline.css';
178
+ $show_title = (empty ($plugin_caption) ? false : true);
179
 
180
+ //Anchor to comments
181
  if ($source == 'comments')
182
  {
183
  $source .= '#comments';
184
  }
 
 
 
 
 
185
  }
186
 
187
  //Providers selected?
188
  if (count ($providers) > 0)
189
  {
190
  //Random integer
191
+ $rand = mt_rand (99999, 9999999);
192
  ?>
193
  <div class="oneall_social_login">
194
  <?php
199
  <?php
200
  }
201
  ?>
202
+ <div class="oneall_social_login_providers" id="oneall_social_login_providers_<?php echo $rand; ?>"></div>
203
  <script type="text/javascript">
204
  oneall.api.plugins.social_login.build("oneall_social_login_providers_<?php echo $rand; ?>", {
205
+ 'providers' : ['<?php echo implode ("','", $providers); ?>'],
206
  'callback_uri': (window.location.href + ((window.location.href.split('?')[1] ? '&':'?') + 'oa_social_login_source=<?php echo $source; ?>')),
207
+ 'css_theme_uri' : '<?php echo $css_theme_uri; ?>'
 
 
208
  });
209
  </script>
210
  </div>
oa-social-login.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Social Login
4
  Plugin URI: http://www.oneall.com/
5
  Description: Allow your visitors to <strong>comment, login and register with 20+ social networks</strong> like Twitter, Facebook, LinkedIn, Hyves, Вконтакте, Google or Yahoo.
6
- Version: 1.3.5
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
3
  Plugin Name: Social Login
4
  Plugin URI: http://www.oneall.com/
5
  Description: Allow your visitors to <strong>comment, login and register with 20+ social networks</strong> like Twitter, Facebook, LinkedIn, Hyves, Вконтакте, Google or Yahoo.
6
+ Version: 1.4
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Social Login ===
2
  Contributors: ClaudeSchlesser
3
- Tags: facebook, linkedin, google, yahoo, twitter, openid, wordpress.com, vkontakte, hyves, social connect, social login
4
  Requires at least: 3.0
5
  Tested up to: 3.2.1
6
- Stable tag: 1.3.5
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, LinkedIn, Hyves, OpenID, Вконтакте, Google, Yahoo
9
 
@@ -20,7 +20,7 @@ Yahoo. <br />
20
  <li>On the registration page</li>
21
  </ul>
22
 
23
- <strong>Optionally add the widget:</strong>
24
  <ul>
25
  <li>A login widget that you can easily attach to your sidebar is provided</li>
26
  </ul>
@@ -76,6 +76,9 @@ It should work out of the box.
76
  Our team answers your request at:
77
  http://www.oneall.com/company/contact-us/
78
 
 
 
 
79
  == Screenshots ==
80
 
81
  1. **Comment** - Comment formular (Social Network Buttons are includes)
@@ -104,4 +107,12 @@ http://www.oneall.com/company/contact-us/
104
  = 1.3.5 =
105
  * Administration area redirection fixed
106
  * Automatic email creation added
107
- * Email verification added
 
 
 
 
 
 
 
 
1
  === Social Login ===
2
  Contributors: ClaudeSchlesser
3
+ Tags: social login, social connect, facebook, linkedin, google, yahoo, twitter, openid, wordpress.com, vkontakte, hyves, widget, plugin, social network login
4
  Requires at least: 3.0
5
  Tested up to: 3.2.1
6
+ Stable tag: 1.4
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, LinkedIn, Hyves, OpenID, Вконтакте, Google, Yahoo
9
 
20
  <li>On the registration page</li>
21
  </ul>
22
 
23
+ <strong>Optionally add the Social Login widget:</strong>
24
  <ul>
25
  <li>A login widget that you can easily attach to your sidebar is provided</li>
26
  </ul>
76
  Our team answers your request at:
77
  http://www.oneall.com/company/contact-us/
78
 
79
+ The plugin documentation is available at:
80
+ http://docs.oneall.com/plugins/guide/social-login-wordpress/
81
+
82
  == Screenshots ==
83
 
84
  1. **Comment** - Comment formular (Social Network Buttons are includes)
107
  = 1.3.5 =
108
  * Administration area redirection fixed
109
  * Automatic email creation added
110
+ * Email verification added
111
+
112
+ = 1.4 =
113
+ * Social Network Avatars can be displayed in comments
114
+ * Social Login can be disabled below the login form
115
+ * Social Login can be disabled below the registration form
116
+ * Select redirection target after login
117
+ * Select redirection target after registration
118
+ * Enable account linking