Social Login - Version 6.6.1

Version Description

  • Fix for issue in editing/uploading BuddyPress profile picture
  • Added check to prohibit insertion of rows in account linking table that have empty field values
  • Removed rows in account linking table that have empty field values
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Social Login
Version 6.6.1
Comparing to
See all releases

Code changes from version 6.6.0 to 6.6.1

class-mo-openid-login-widget.php CHANGED
@@ -2250,41 +2250,46 @@ if(mo_openid_is_customer_registered()) {
2250
  $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\" AND linked_social_app = \"%s\"",$user_email,$social_app_name));
2251
 
2252
  // if a user with given email and social app name doesn't already exist in the mo_openid_linked_user table
2253
- if(!isset($linked_email_id) && !empty($user_email)){
2254
  mo_openid_insert_query($social_app_name,$user_email,$userid,$social_app_identifier);
2255
  }
2256
  }
2257
 
2258
  function mo_openid_insert_query($social_app_name,$user_email,$userid,$social_app_identifier){
2259
- date_default_timezone_set('Asia/Kolkata');
2260
- $date = date('Y-m-d H:i:s');
2261
 
2262
- global $wpdb;
2263
- $db_prefix = $wpdb->prefix;
2264
- $table_name = $db_prefix. 'mo_openid_linked_user';
2265
-
2266
- $result = $wpdb->insert(
2267
- $table_name,
2268
- array(
2269
- 'linked_social_app' => $social_app_name,
2270
- 'linked_email' => $user_email,
2271
- 'user_id' => $userid,
2272
- 'identifier' => $social_app_identifier,
2273
- 'timestamp' => $date,
2274
- ),
2275
- array(
2276
- '%s',
2277
- '%s',
2278
- '%d',
2279
- '%s',
2280
- '%s'
2281
- )
2282
- );
2283
- if($result === false){
2284
- /*$wpdb->show_errors();
2285
- $wpdb->print_error();
2286
- exit;*/
2287
- wp_die('Error in insert query');
 
 
 
 
 
 
 
2288
  }
2289
  }
2290
 
2250
  $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\" AND linked_social_app = \"%s\"",$user_email,$social_app_name));
2251
 
2252
  // if a user with given email and social app name doesn't already exist in the mo_openid_linked_user table
2253
+ if(!isset($linked_email_id)){
2254
  mo_openid_insert_query($social_app_name,$user_email,$userid,$social_app_identifier);
2255
  }
2256
  }
2257
 
2258
  function mo_openid_insert_query($social_app_name,$user_email,$userid,$social_app_identifier){
 
 
2259
 
2260
+ // check if none of the column values are empty
2261
+ if(!empty($social_app_name) && !empty($user_email) && !empty($userid) && !empty($social_app_identifier)){
2262
+
2263
+ date_default_timezone_set('Asia/Kolkata');
2264
+ $date = date('Y-m-d H:i:s');
2265
+
2266
+ global $wpdb;
2267
+ $db_prefix = $wpdb->prefix;
2268
+ $table_name = $db_prefix. 'mo_openid_linked_user';
2269
+
2270
+ $result = $wpdb->insert(
2271
+ $table_name,
2272
+ array(
2273
+ 'linked_social_app' => $social_app_name,
2274
+ 'linked_email' => $user_email,
2275
+ 'user_id' => $userid,
2276
+ 'identifier' => $social_app_identifier,
2277
+ 'timestamp' => $date,
2278
+ ),
2279
+ array(
2280
+ '%s',
2281
+ '%s',
2282
+ '%d',
2283
+ '%s',
2284
+ '%s'
2285
+ )
2286
+ );
2287
+ if($result === false){
2288
+ /* $wpdb->show_errors();
2289
+ $wpdb->print_error();
2290
+ exit;*/
2291
+ wp_die('Error in insert query');
2292
+ }
2293
  }
2294
  }
2295
 
miniorange_openid_sso_settings.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
7
- * Version: 6.6.0
8
  * Author: miniOrange
9
  * Author URI: https://www.miniorange.com
10
  * License: GPL2
@@ -15,6 +15,7 @@ include_once dirname( __FILE__ ) . '/class-mo-openid-login-widget.php';
15
  require('class-mo-openid-sso-customer.php');
16
  require('class-mo-openid-sso-shortcode-buttons.php');
17
  require('class-mo-openid-social-comment.php');
 
18
 
19
  class Miniorange_OpenID_SSO {
20
 
@@ -273,7 +274,7 @@ class Miniorange_OpenID_SSO {
273
  $prepared_statement = $wpdb->prepare( "SELECT {$column_name} FROM {$table_name} WHERE {$column_name} like %s", $column_name );
274
  $timestamp_column = $wpdb->get_col( $prepared_statement );
275
 
276
- // if table doesn't exist or the 'timestamp' column doesn't exist
277
  if($wpdb->get_var("show tables like '$table_name'") != $table_name || empty($timestamp_column) ) {
278
  $sql = "CREATE TABLE $table_name (
279
  id mediumint(9) NOT NULL AUTO_INCREMENT,
@@ -335,6 +336,31 @@ class Miniorange_OpenID_SSO {
335
  $wpdb->get_var("ALTER TABLE $wpdb->users DROP COLUMN identifier");
336
  }
337
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
 
340
  function mo_openid_activate() {
@@ -353,9 +379,6 @@ class Miniorange_OpenID_SSO {
353
  global $post;
354
  $post_content=$content;
355
  $title = str_replace('+', '%20', urlencode($post->post_title));
356
- $content=strip_shortcodes( strip_tags( get_the_content() ) );
357
- $excerpt = '';
358
- $landscape = 'hor';
359
 
360
  if(is_front_page() && get_option('mo_share_options_enable_home_page')==1){
361
  $html_content = mo_openid_share_shortcode('', $title);
@@ -1162,7 +1185,6 @@ class Miniorange_OpenID_SSO {
1162
  }
1163
 
1164
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
1165
- $user = false;
1166
 
1167
  if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have a user identifier
1168
  $user_id = $mixed;
@@ -1174,14 +1196,20 @@ class Miniorange_OpenID_SSO {
1174
  $user_id = null;
1175
  }
1176
 
1177
- if ( !empty( $user_id ) ) { //User found?
1178
- $override_avatar = true; //Override current avatar ?
1179
- $user_meta_thumbnail = get_user_meta( $user_id, 'moopenid_user_avatar', true ); //Read the avatar
1180
- $user_meta_name = get_user_meta( $user_id, 'user_name', true ); //read user details
1181
- // if ( $options['apsl_user_avatar_options'] == 'social' ) {
1182
- $user_picture = (!empty( $user_meta_thumbnail ) ? $user_meta_thumbnail : '');
1183
- if ( $user_picture !== false AND strlen( trim( $user_picture ) ) > 0 ) { //Avatar found?
1184
- return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
 
 
 
 
 
 
1185
  }
1186
  }
1187
  return $avatar;
@@ -1190,25 +1218,30 @@ class Miniorange_OpenID_SSO {
1190
  function mo_social_login_buddypress_avatar( $text, $args) {
1191
  if(is_array($args)){
1192
  if(!empty($args['object']) && strtolower($args['object']) == 'user'){
1193
- if(!empty($args['item_id']) && is_numeric($args['item_id'])){
1194
- if(($userdata = get_userdata($args['item_id'])) !== false){
1195
- $user_meta_thumbnail = get_user_meta( $userdata->ID, 'moopenid_user_avatar', true ); //Read the avatar
1196
- $user_meta_name = $userdata->user_login; //read user details
1197
- $user_picture = (!empty( $user_meta_thumbnail ) ? $user_meta_thumbnail : '');
1198
- $size = (!empty($args['width']) ? 'width="'.$args['width'].'" ' : 'width="50"');
1199
- if ( $user_picture !== false AND strlen( trim( $user_picture ) ) > 0 ) { //Avatar found?
1200
- return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
1201
- }
1202
- }
1203
- }
 
 
 
 
 
 
 
1204
  }
1205
  }
1206
  return $text;
1207
  }
1208
 
1209
  function mo_social_login_custom_avatar_url( $url, $id_or_email, $args = null ) {
1210
- $user = false;
1211
-
1212
  if ( is_numeric( $id_or_email ) AND $id_or_email > 0 ) { //Check if we have an user identifier
1213
  $user_id = $id_or_email;
1214
  } elseif ( is_string( $id_or_email ) AND ( $user = get_user_by( 'email', $id_or_email )) ) { //Check if we have an user email
@@ -1220,12 +1253,27 @@ class Miniorange_OpenID_SSO {
1220
  }
1221
 
1222
  if ( !empty( $user_id ) ) {
1223
- $user_meta_thumbnail = get_user_meta( $user_id, 'moopenid_user_avatar', true );
1224
- $user_picture = (!empty( $user_meta_thumbnail ) ? $user_meta_thumbnail : $url);
1225
- return $user_picture;
1226
- }
 
 
 
 
 
 
 
1227
  return $url;
1228
  }
 
 
 
 
 
 
 
 
1229
  }
1230
 
1231
  new Miniorange_OpenID_SSO;
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
7
+ * Version: 6.6.1
8
  * Author: miniOrange
9
  * Author URI: https://www.miniorange.com
10
  * License: GPL2
15
  require('class-mo-openid-sso-customer.php');
16
  require('class-mo-openid-sso-shortcode-buttons.php');
17
  require('class-mo-openid-social-comment.php');
18
+ define('MO_OPENID_SOCIAL_LOGIN_VERSION', '6.6.1');
19
 
20
  class Miniorange_OpenID_SSO {
21
 
274
  $prepared_statement = $wpdb->prepare( "SELECT {$column_name} FROM {$table_name} WHERE {$column_name} like %s", $column_name );
275
  $timestamp_column = $wpdb->get_col( $prepared_statement );
276
 
277
+ // if table mo_openid_linked_user doesn't exist or the 'timestamp' column doesn't exist
278
  if($wpdb->get_var("show tables like '$table_name'") != $table_name || empty($timestamp_column) ) {
279
  $sql = "CREATE TABLE $table_name (
280
  id mediumint(9) NOT NULL AUTO_INCREMENT,
336
  $wpdb->get_var("ALTER TABLE $wpdb->users DROP COLUMN identifier");
337
  }
338
  }
339
+
340
+ $current_version = get_option('mo_openid_social_login_version');
341
+
342
+ if(!$current_version && version_compare(MO_OPENID_SOCIAL_LOGIN_VERSION,"6.6.1",">=")){
343
+ //delete entries from mo_openid_linked_user table which have empty column values
344
+ $result = $wpdb->query(
345
+ $wpdb->prepare(
346
+ "
347
+ DELETE FROM {$table_name}
348
+ WHERE linked_social_app = %s
349
+ OR linked_email = %s
350
+ OR user_id = %d
351
+ OR identifier = %s
352
+ ",
353
+ '','',0, ''
354
+ )
355
+ );
356
+ if($result === false){
357
+ /*$wpdb->show_errors();
358
+ $wpdb->print_error();
359
+ exit;*/
360
+ wp_die('Error in deletion query');
361
+ }
362
+ }
363
+ update_option('mo_openid_social_login_version',MO_OPENID_SOCIAL_LOGIN_VERSION);
364
  }
365
 
366
  function mo_openid_activate() {
379
  global $post;
380
  $post_content=$content;
381
  $title = str_replace('+', '%20', urlencode($post->post_title));
 
 
 
382
 
383
  if(is_front_page() && get_option('mo_share_options_enable_home_page')==1){
384
  $html_content = mo_openid_share_shortcode('', $title);
1185
  }
1186
 
1187
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
 
1188
 
1189
  if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have a user identifier
1190
  $user_id = $mixed;
1196
  $user_id = null;
1197
  }
1198
 
1199
+ if ( !empty( $user_id ) ) { //User found?
1200
+ $filename = '';
1201
+ if ($this->mo_openid_is_buddypress_active()) {
1202
+ $filename = bp_upload_dir();
1203
+ $filename = $filename['basedir'] . "/avatars/" . $user_id;
1204
+ }
1205
+ if (!(is_dir($filename))) {
1206
+ $user_meta_thumbnail = get_user_meta($user_id, 'moopenid_user_avatar', true); //Read the avatar
1207
+ $user_meta_name = get_user_meta($user_id, 'user_name', true); //read user details
1208
+ // if ( $options['apsl_user_avatar_options'] == 'social' ) {
1209
+ $user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : '');
1210
+ if ($user_picture !== false AND strlen(trim($user_picture)) > 0) { //Avatar found?
1211
+ return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
1212
+ }
1213
  }
1214
  }
1215
  return $avatar;
1218
  function mo_social_login_buddypress_avatar( $text, $args) {
1219
  if(is_array($args)){
1220
  if(!empty($args['object']) && strtolower($args['object']) == 'user'){
1221
+ if(!empty($args['item_id']) && is_numeric($args['item_id'])) {
1222
+ $filename = '';
1223
+ if ($this->mo_openid_is_buddypress_active()) {
1224
+ $filename = bp_upload_dir();
1225
+ $filename = $filename['basedir'] . "/avatars/" . $args['item_id'];
1226
+ }
1227
+ if (!(is_dir($filename))) {
1228
+ if (($userdata = get_userdata($args['item_id'])) !== false) {
1229
+ $user_meta_thumbnail = get_user_meta($userdata->ID, 'moopenid_user_avatar', true); //Read the avatar
1230
+ $user_meta_name = $userdata->user_login; //read user details
1231
+ $user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : '');
1232
+ $size = (!empty($args['width']) ? 'width="' . $args['width'] . '" ' : 'width="50"');
1233
+ if ($user_picture !== false AND strlen(trim($user_picture)) > 0) { //Avatar found?
1234
+ return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
  }
1240
  }
1241
  return $text;
1242
  }
1243
 
1244
  function mo_social_login_custom_avatar_url( $url, $id_or_email, $args = null ) {
 
 
1245
  if ( is_numeric( $id_or_email ) AND $id_or_email > 0 ) { //Check if we have an user identifier
1246
  $user_id = $id_or_email;
1247
  } elseif ( is_string( $id_or_email ) AND ( $user = get_user_by( 'email', $id_or_email )) ) { //Check if we have an user email
1253
  }
1254
 
1255
  if ( !empty( $user_id ) ) {
1256
+ $filename = '';
1257
+ if ($this->mo_openid_is_buddypress_active()) {
1258
+ $filename = bp_upload_dir();
1259
+ $filename = $filename['basedir'] . "/avatars/" . $user_id;
1260
+ }
1261
+ if (!(is_dir($filename))) {
1262
+ $user_meta_thumbnail = get_user_meta($user_id, 'moopenid_user_avatar', true);
1263
+ $user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : $url);
1264
+ return $user_picture;
1265
+ }
1266
+ }
1267
  return $url;
1268
  }
1269
+
1270
+ function mo_openid_is_buddypress_active(){
1271
+ include_once(ABSPATH.'wp-admin/includes/plugin.php');
1272
+ if(is_plugin_active('buddypress/bp-loader.php') )
1273
+ return true;
1274
+ else
1275
+ return false;
1276
+ }
1277
  }
1278
 
1279
  new Miniorange_OpenID_SSO;
miniorange_openid_sso_settings_page.php CHANGED
@@ -2675,11 +2675,6 @@ function mo_openid_pricing_info(){
2675
  <td style="vertical-align:top;width:100%;">
2676
  <div class="mo_openid_table_layout">
2677
 
2678
- <?php if(get_option('mo_openid_oauth')!='1') { ?>
2679
- <div style="display:block;margin-top:10px;color:black;background-color:#f7faff;padding:5px;border:solid 1px #b7d1ff;">
2680
- We have recently revised the Social Login Plans. Some plugin integrations and popular features have been added. Take a look. :)</div>
2681
- <?php } ?>
2682
-
2683
  <h2>Licensing Plans For Social Login
2684
  <?php if(get_option('mo_openid_oauth')!='1') {?>
2685
  <span style="float:right">
2675
  <td style="vertical-align:top;width:100%;">
2676
  <div class="mo_openid_table_layout">
2677
 
 
 
 
 
 
2678
  <h2>Licensing Plans For Social Login
2679
  <?php if(get_option('mo_openid_oauth')!='1') {?>
2680
  <span style="float:right">
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.miniorange.com
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
  Tested up to: 4.9.4
7
- Stable tag: 6.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -165,6 +165,11 @@ Please email us at info@miniorange.com. You can also submit your query from the
165
 
166
 
167
  == Changelog ==
 
 
 
 
 
168
  = 6.6.0 =
169
  * Added resend otp in Profile Completion
170
  * Added column timestamp in account linking table
@@ -511,6 +516,11 @@ Please email us at info@miniorange.com. You can also submit your query from the
511
  * First version of Social Login, Social Sharing plugin.
512
 
513
  == Upgrade Notice ==
 
 
 
 
 
514
  = 6.6.0 =
515
  * Added resend otp in Profile Completion
516
  * Added column timestamp in account linking table
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
  Tested up to: 4.9.4
7
+ Stable tag: 6.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
165
 
166
 
167
  == Changelog ==
168
+ = 6.6.1 =
169
+ * Fix for issue in editing/uploading BuddyPress profile picture
170
+ * Added check to prohibit insertion of rows in account linking table that have empty field values
171
+ * Removed rows in account linking table that have empty field values
172
+
173
  = 6.6.0 =
174
  * Added resend otp in Profile Completion
175
  * Added column timestamp in account linking table
516
  * First version of Social Login, Social Sharing plugin.
517
 
518
  == Upgrade Notice ==
519
+ = 6.6.1 =
520
+ * Fix for issue in editing/uploading BuddyPress profile picture
521
+ * Added check to prohibit insertion of rows in account linking table that have empty field values
522
+ * Removed rows in account linking table that have empty field values
523
+
524
  = 6.6.0 =
525
  * Added resend otp in Profile Completion
526
  * Added column timestamp in account linking table
uninstall.php CHANGED
@@ -144,4 +144,6 @@
144
  delete_option( 'mo_openid_enable_custom_app_google');
145
  delete_option( 'mo_openid_enable_custom_app_facebook');
146
  delete_option( 'mo_openid_enable_custom_app_twitter');
 
 
147
  ?>
144
  delete_option( 'mo_openid_enable_custom_app_google');
145
  delete_option( 'mo_openid_enable_custom_app_facebook');
146
  delete_option( 'mo_openid_enable_custom_app_twitter');
147
+
148
+ delete_option('mo_openid_social_login_version');
149
  ?>