WP ULike - Version 3.3.1

Version Description

  • Fixed: An old issue with database structure.
  • Fixed: An important bug with logging methods.
Download this release

Release Info

Developer alimir
Plugin Icon 128x128 WP ULike
Version 3.3.1
Comparing to
See all releases

Code changes from version 3.3 to 3.3.1

admin/assets/js/settings.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v3.3
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
1
+ /*! WP ULike - v3.3.1
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
admin/assets/js/statistics.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v3.3
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
1
+ /*! WP ULike - v3.3.1
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
assets/js/wp-ulike.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v3.3
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
1
+ /*! WP ULike - v3.3.1
2
  * https://wpulike.com
3
  * Alimir 2018;
4
  */
inc/classes/class-wp-ulike.php CHANGED
@@ -12,6 +12,7 @@ if ( ! class_exists( 'wp_ulike' ) ) {
12
  class wp_ulike{
13
 
14
  private $wpdb, $status;
 
15
  /**
16
  * Instance of this class.
17
  *
@@ -45,7 +46,7 @@ if ( ! class_exists( 'wp_ulike' ) ) {
45
  return;
46
  }
47
  //Add wp_ulike script file with special functions.
48
- wp_enqueue_script( 'wp_ulike', WP_ULIKE_ASSETS_URL . '/js/wp-ulike.min.js', array( 'jquery' ), '3.2', true);
49
 
50
  //localize script
51
  wp_localize_script( 'wp_ulike', 'wp_ulike_params', array(
@@ -79,10 +80,10 @@ if ( ! class_exists( 'wp_ulike' ) ) {
79
  return $this->loggedby_cookie_method( $data );
80
  break;
81
  case 'by_ip':
82
- return $this->loggedby_ip_method( $data );
83
  break;
84
  default:
85
- return $this->loggedby_username( $data );
86
  }
87
  }
88
 
@@ -95,9 +96,11 @@ if ( ! class_exists( 'wp_ulike' ) ) {
95
  * @since 2.0
96
  * @return String
97
  */
98
- public function do_not_log_method( array $data, $output = '' ){
99
  // Extract data
100
  extract( $data );
 
 
101
 
102
  if( $type == 'post' ){
103
  $output = $this->get_template( $data, 1 );
@@ -109,11 +112,11 @@ if ( ! class_exists( 'wp_ulike' ) ) {
109
  $this->wpdb->insert(
110
  $this->wpdb->prefix . $table,
111
  array(
112
- $column => $id,
113
- 'date_time' => current_time( 'mysql' ),
114
- 'ip' => $user_ip,
115
- 'user_id' => $user_id,
116
- 'status' => $this->status
117
  )
118
  );
119
  // Formatting the output
@@ -143,9 +146,11 @@ if ( ! class_exists( 'wp_ulike' ) ) {
143
  * @since 2.0
144
  * @return String
145
  */
146
- public function loggedby_cookie_method( array $data, $output = '' ){
147
  // Extract data
148
  extract( $data );
 
 
149
 
150
  if( $type == 'post' ){
151
 
@@ -167,11 +172,11 @@ if ( ! class_exists( 'wp_ulike' ) ) {
167
  $this->wpdb->insert(
168
  $this->wpdb->prefix . $table,
169
  array(
170
- $column => $id,
171
- 'date_time' => current_time( 'mysql' ),
172
- 'ip' => $user_ip,
173
- 'user_id' => $user_id,
174
- 'status' => $this->status
175
  )
176
  );
177
 
@@ -194,113 +199,33 @@ if ( ! class_exists( 'wp_ulike' ) ) {
194
  return $output;
195
  }
196
 
197
- /**
198
- * Logged by IP method
199
- *
200
- * @author Alimir
201
- * @param Array $data
202
- * @since 2.0
203
- * @return String
204
- */
205
- public function loggedby_ip_method( array $data, $output = '' ){
206
- // Check the user's likes history
207
- $has_log = $this->has_log( $data );
208
- // Extract data
209
- extract( $data );
210
-
211
- if( $type == 'post' ) {
212
-
213
- if( ! $has_log ){
214
- $output = $this->get_template( $data, 3 );
215
-
216
- } else {
217
-
218
- if( $this->get_user_status( $table, $column, 'ip', $id, $user_ip ) == "like" ){
219
- $output = $this->get_template( $data, 2 );
220
- } else{
221
- $output = $this->get_template( $data, 3 );
222
- }
223
-
224
- }
225
-
226
- } elseif( $type == 'process' ) {
227
-
228
- if( ! $has_log ){
229
- // Increment like counter
230
- ++$get_like;
231
- // Insert log data
232
- $this->wpdb->insert(
233
- $this->wpdb->prefix . $table,
234
- array(
235
- $column => $id,
236
- 'date_time' => current_time( 'mysql' ),
237
- 'ip' => $user_ip,
238
- 'user_id' => $user_id,
239
- 'status' => $this->status
240
- )
241
- );
242
-
243
- } else {
244
-
245
- if( $this->get_user_status( $table, $column, 'user_id', $id, $user_id ) === "like" ) {
246
- // Decrement like counter
247
- --$get_like;
248
- $this->status = 'unlike';
249
- } else {
250
- // Increment like counter
251
- ++$get_like;
252
- }
253
- // Update status
254
- $this->wpdb->update(
255
- $this->wpdb->prefix . $table,
256
- array(
257
- 'status' => $this->status
258
- ),
259
- array( $column => $id, 'user_id' => $user_id )
260
- );
261
- }
262
-
263
- // Formatting the output
264
- $output = wp_ulike_format_number( $this->update_meta_data( $id, $key, $get_like ) );
265
- // After process hook
266
- do_action_ref_array( 'wp_ulike_after_process',
267
- array(
268
- 'id' => $id,
269
- 'key' => $key,
270
- 'user_id' => $user_id,
271
- 'status' => $this->status,
272
- 'has_log' => $has_log
273
- )
274
- );
275
-
276
- }
277
-
278
- return $output;
279
- }
280
-
281
  /**
282
  * Logged by IP/UserName method
283
  *
284
  * @author Alimir
285
  * @param Array $data
286
- * @param String $output
287
  * @since 2.0
288
  * @return String
289
  */
290
- public function loggedby_username( array $data, $output = '' ){
291
- // Check the user's likes history
292
- $has_log = $this->has_log( $data );
293
  // Extract data
294
  extract( $data );
 
 
 
 
 
 
295
 
296
  if( $type == 'post' ){
297
 
298
- if( ! $has_log ){
299
  $output = $this->get_template( $data, 3 );
300
 
301
  } else {
302
 
303
- if( $this->get_user_status( $table, $column, 'user_id', $id, $user_id ) == "like" ) {
304
  $output = $this->get_template( $data, 2 );
305
 
306
  } else {
@@ -311,24 +236,24 @@ if ( ! class_exists( 'wp_ulike' ) ) {
311
 
312
  } elseif( $type == 'process' ) {
313
 
314
- if( ! $has_log ){
315
  // Increment like counter
316
  ++$get_like;
317
  // Insert log data
318
  $this->wpdb->insert(
319
  $this->wpdb->prefix . $table,
320
  array(
321
- $column => $id,
322
- 'date_time' => current_time( 'mysql' ),
323
- 'ip' => $user_ip,
324
- 'user_id' => $user_id,
325
- 'status' => $this->status
326
  )
327
  );
328
 
329
  } else {
330
 
331
- if( $this->get_user_status( $table, $column, 'user_id', $id, $user_id ) == "like" ) {
332
  // Decrement like counter
333
  --$get_like;
334
  $this->status = 'unlike';
@@ -342,7 +267,7 @@ if ( ! class_exists( 'wp_ulike' ) ) {
342
  array(
343
  'status' => $this->status
344
  ),
345
- array( $column => $id, 'user_id' => $user_id )
346
  );
347
  }
348
 
@@ -355,7 +280,7 @@ if ( ! class_exists( 'wp_ulike' ) ) {
355
  'key' => $key,
356
  'user_id' => $user_id,
357
  'status' => $this->status,
358
- 'has_log' => $has_log
359
  )
360
  );
361
 
@@ -488,28 +413,6 @@ if ( ! class_exists( 'wp_ulike' ) ) {
488
 
489
  }
490
 
491
- /**
492
- * Get User Status (like/dislike)
493
- *
494
- * @author Alimir
495
- * @param String $table
496
- * @param String $first_column
497
- * @param String $second_column
498
- * @param String $first_val
499
- * @param String $second_val
500
- * @since 2.0
501
- * @return String
502
- */
503
- public function get_user_status( $table, $first_column, $second_column, $first_val, $second_val ){
504
- // This will return like|unlike
505
- return $this->wpdb->get_var( "
506
- SELECT status
507
- FROM ".$this->wpdb->prefix."$table
508
- WHERE $first_column = '$first_val'
509
- AND $second_column = '$second_val'
510
- ");
511
- }
512
-
513
  /**
514
  * Get Liked User
515
  *
@@ -582,6 +485,28 @@ if ( ! class_exists( 'wp_ulike' ) ) {
582
 
583
  }
584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
  /**
586
  * Get Current User Likes List
587
  *
@@ -597,7 +522,7 @@ if ( ! class_exists( 'wp_ulike' ) ) {
597
  SELECT COUNT(*)
598
  FROM ".$this->wpdb->prefix.$table."
599
  WHERE $column = '$id'
600
- AND user_id = '$user_id'
601
  " );
602
  }
603
 
12
  class wp_ulike{
13
 
14
  private $wpdb, $status;
15
+
16
  /**
17
  * Instance of this class.
18
  *
46
  return;
47
  }
48
  //Add wp_ulike script file with special functions.
49
+ wp_enqueue_script( 'wp_ulike', WP_ULIKE_ASSETS_URL . '/js/wp-ulike.min.js', array( 'jquery' ), '3.3.1', true);
50
 
51
  //localize script
52
  wp_localize_script( 'wp_ulike', 'wp_ulike_params', array(
80
  return $this->loggedby_cookie_method( $data );
81
  break;
82
  case 'by_ip':
83
+ return $this->loggedby_other_methods( $data, 'ip' );
84
  break;
85
  default:
86
+ return $this->loggedby_other_methods( $data );
87
  }
88
  }
89
 
96
  * @since 2.0
97
  * @return String
98
  */
99
+ public function do_not_log_method( array $data ){
100
  // Extract data
101
  extract( $data );
102
+ // output value
103
+ $output = '';
104
 
105
  if( $type == 'post' ){
106
  $output = $this->get_template( $data, 1 );
112
  $this->wpdb->insert(
113
  $this->wpdb->prefix . $table,
114
  array(
115
+ $column => $id,
116
+ 'date_time' => current_time( 'mysql' ),
117
+ 'ip' => $user_ip,
118
+ 'user_id' => $user_id,
119
+ 'status' => $this->status
120
  )
121
  );
122
  // Formatting the output
146
  * @since 2.0
147
  * @return String
148
  */
149
+ public function loggedby_cookie_method( array $data ){
150
  // Extract data
151
  extract( $data );
152
+ // output value
153
+ $output = '';
154
 
155
  if( $type == 'post' ){
156
 
172
  $this->wpdb->insert(
173
  $this->wpdb->prefix . $table,
174
  array(
175
+ $column => $id,
176
+ 'date_time' => current_time( 'mysql' ),
177
+ 'ip' => $user_ip,
178
+ 'user_id' => $user_id,
179
+ 'status' => $this->status
180
  )
181
  );
182
 
199
  return $output;
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /**
203
  * Logged by IP/UserName method
204
  *
205
  * @author Alimir
206
  * @param Array $data
207
+ * @param String $method_col
208
  * @since 2.0
209
  * @return String
210
  */
211
+ public function loggedby_other_methods( array $data, $method_col = 'user_id' ){
 
 
212
  // Extract data
213
  extract( $data );
214
+ // Check the user's likes history
215
+ $output = '';
216
+ // method column value
217
+ $method_val = $method_col === 'ip' ? $user_ip : $user_id;
218
+ // Check user log history
219
+ $has_log = $this->get_user_status( $table, $column, $method_col, $id, $method_val );
220
 
221
  if( $type == 'post' ){
222
 
223
+ if( empty( $has_log ) ){
224
  $output = $this->get_template( $data, 3 );
225
 
226
  } else {
227
 
228
+ if( $has_log == "like" ) {
229
  $output = $this->get_template( $data, 2 );
230
 
231
  } else {
236
 
237
  } elseif( $type == 'process' ) {
238
 
239
+ if( empty( $has_log ) ){
240
  // Increment like counter
241
  ++$get_like;
242
  // Insert log data
243
  $this->wpdb->insert(
244
  $this->wpdb->prefix . $table,
245
  array(
246
+ $column => $id,
247
+ 'date_time' => current_time( 'mysql' ),
248
+ 'ip' => $user_ip,
249
+ 'user_id' => $user_id,
250
+ 'status' => $this->status
251
  )
252
  );
253
 
254
  } else {
255
 
256
+ if( $has_log == "like" ) {
257
  // Decrement like counter
258
  --$get_like;
259
  $this->status = 'unlike';
267
  array(
268
  'status' => $this->status
269
  ),
270
+ array( $column => $id, $method_col => $method_val )
271
  );
272
  }
273
 
280
  'key' => $key,
281
  'user_id' => $user_id,
282
  'status' => $this->status,
283
+ 'has_log' => empty( $has_log ) ? 0 : 1
284
  )
285
  );
286
 
413
 
414
  }
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  /**
417
  * Get Liked User
418
  *
485
 
486
  }
487
 
488
+ /**
489
+ * Get User Status (like/dislike)
490
+ *
491
+ * @author Alimir
492
+ * @param String $table
493
+ * @param String $first_column
494
+ * @param String $second_column
495
+ * @param String $first_val
496
+ * @param String $second_val
497
+ * @since 2.0
498
+ * @return String
499
+ */
500
+ public function get_user_status( $table, $first_column, $second_column, $first_val, $second_val ){
501
+ // This will return like|unlike
502
+ return $this->wpdb->get_var( "
503
+ SELECT status
504
+ FROM ".$this->wpdb->prefix."$table
505
+ WHERE $first_column = '$first_val'
506
+ AND $second_column = '$second_val'
507
+ " );
508
+ }
509
+
510
  /**
511
  * Get Current User Likes List
512
  *
522
  SELECT COUNT(*)
523
  FROM ".$this->wpdb->prefix.$table."
524
  WHERE $column = '$id'
525
+ AND ( user_id = '$user_id' OR ip = '$user_ip' )
526
  " );
527
  }
528
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author: Ali Mirzaei
5
  Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin, buddypress like system, buddypress votes, comment like system, voting button, wordpress, buddypress, statistics, stats likes, bbpress, bbPress like, WP-Translations, forums, community, credit, points, mycred, users, ultimate member
6
  Requires at least: 3.5
7
  Tested up to: 4.9.6
8
- Stable tag: 3.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -174,6 +174,10 @@ define( 'WP_MEMORY_LIMIT', '256M' );
174
 
175
  == Changelog ==
176
 
 
 
 
 
177
  = 3.3 =
178
  * Added: AJAX refresh for likers box.
179
  * Added: Anonymize IP option for GDPR compliance.
5
  Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin, buddypress like system, buddypress votes, comment like system, voting button, wordpress, buddypress, statistics, stats likes, bbpress, bbPress like, WP-Translations, forums, community, credit, points, mycred, users, ultimate member
6
  Requires at least: 3.5
7
  Tested up to: 4.9.6
8
+ Stable tag: 3.3.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
174
 
175
  == Changelog ==
176
 
177
+ = 3.3.1 =
178
+ * Fixed: An old issue with database structure.
179
+ * Fixed: An important bug with logging methods.
180
+
181
  = 3.3 =
182
  * Added: AJAX refresh for likers box.
183
  * Added: Anonymize IP option for GDPR compliance.
wp-assets/banner-1544x500.png DELETED
Binary file
wp-assets/banner-772x250.png DELETED
Binary file
wp-assets/icon-128x128.png DELETED
Binary file
wp-assets/icon-256x256.png DELETED
Binary file
wp-assets/screenshot-1.png DELETED
Binary file
wp-assets/screenshot-2.png DELETED
Binary file
wp-assets/screenshot-3.png DELETED
Binary file
wp-assets/screenshot-4.png DELETED
Binary file
wp-ulike.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/
12
  * Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
13
- * Version: 3.3
14
  * Author: Ali Mirzaei
15
  * Author URI: http://alimir.ir
16
  * Text Domain: wp-ulike
@@ -36,9 +36,9 @@
36
 
37
  // Do not change these values
38
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
39
- define( 'WP_ULIKE_VERSION' , '3.3' );
40
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
41
- define( 'WP_ULIKE_DB_VERSION' , '1.3' );
42
 
43
  define( 'WP_ULIKE_DIR' , plugin_dir_path( __FILE__ ) );
44
  define( 'WP_ULIKE_URL' , plugins_url( '', __FILE__ ) );
@@ -423,15 +423,16 @@ if ( ! class_exists( 'WPULIKE' ) ) :
423
  `post_id` int(11) NOT NULL,
424
  `date_time` datetime NOT NULL,
425
  `ip` varchar(30) NOT NULL,
426
- `user_id` int(11) UNSIGNED NOT NULL,
427
  `status` varchar(15) NOT NULL,
428
  PRIMARY KEY (`id`)
429
  );";
430
 
431
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
432
  dbDelta( $sql );
433
-
434
- add_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
 
435
  }
436
 
437
  $comments_table = $wpdb->prefix . "ulike_comments";
@@ -441,15 +442,16 @@ if ( ! class_exists( 'WPULIKE' ) ) :
441
  `comment_id` int(11) NOT NULL,
442
  `date_time` datetime NOT NULL,
443
  `ip` varchar(30) NOT NULL,
444
- `user_id` int(11) UNSIGNED NOT NULL,
445
  `status` varchar(15) NOT NULL,
446
  PRIMARY KEY (`id`)
447
  );";
448
 
449
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
450
  dbDelta( $sql );
451
-
452
- update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
 
453
  }
454
 
455
  $activities_table = $wpdb->prefix . "ulike_activities";
@@ -459,15 +461,16 @@ if ( ! class_exists( 'WPULIKE' ) ) :
459
  `activity_id` int(11) NOT NULL,
460
  `date_time` datetime NOT NULL,
461
  `ip` varchar(30) NOT NULL,
462
- `user_id` int(11) UNSIGNED NOT NULL,
463
  `status` varchar(15) NOT NULL,
464
  PRIMARY KEY (`id`)
465
  );";
466
 
467
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
468
  dbDelta( $sql );
469
-
470
- update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
 
471
  }
472
 
473
  $forums_table = $wpdb->prefix . "ulike_forums";
@@ -477,17 +480,20 @@ if ( ! class_exists( 'WPULIKE' ) ) :
477
  `topic_id` int(11) NOT NULL,
478
  `date_time` datetime NOT NULL,
479
  `ip` varchar(30) NOT NULL,
480
- `user_id` int(11) UNSIGNED NOT NULL,
481
  `status` varchar(15) NOT NULL,
482
  PRIMARY KEY (`id`)
483
  );";
484
 
485
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
486
  dbDelta( $sql );
487
-
488
- update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
 
489
  }
490
 
 
 
491
  }
492
 
493
  do_action( 'wp_ulike_activated', get_current_blog_id() );
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/
12
  * Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
13
+ * Version: 3.3.1
14
  * Author: Ali Mirzaei
15
  * Author URI: http://alimir.ir
16
  * Text Domain: wp-ulike
36
 
37
  // Do not change these values
38
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
39
+ define( 'WP_ULIKE_VERSION' , '3.3.1' );
40
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
41
+ define( 'WP_ULIKE_DB_VERSION' , '1.4' );
42
 
43
  define( 'WP_ULIKE_DIR' , plugin_dir_path( __FILE__ ) );
44
  define( 'WP_ULIKE_URL' , plugins_url( '', __FILE__ ) );
423
  `post_id` int(11) NOT NULL,
424
  `date_time` datetime NOT NULL,
425
  `ip` varchar(30) NOT NULL,
426
+ `user_id` bigint(20) UNSIGNED NOT NULL,
427
  `status` varchar(15) NOT NULL,
428
  PRIMARY KEY (`id`)
429
  );";
430
 
431
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
432
  dbDelta( $sql );
433
+ } else {
434
+ // Fix an old issue with user_id column
435
+ $wpdb->query( "ALTER TABLE $posts_table CHANGE `user_id` `user_id` BIGINT(20) UNSIGNED NOT NULL" );
436
  }
437
 
438
  $comments_table = $wpdb->prefix . "ulike_comments";
442
  `comment_id` int(11) NOT NULL,
443
  `date_time` datetime NOT NULL,
444
  `ip` varchar(30) NOT NULL,
445
+ `user_id` bigint(20) UNSIGNED NOT NULL,
446
  `status` varchar(15) NOT NULL,
447
  PRIMARY KEY (`id`)
448
  );";
449
 
450
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
451
  dbDelta( $sql );
452
+ } else {
453
+ // Fix an old issue with user_id column
454
+ $wpdb->query( "ALTER TABLE $comments_table CHANGE `user_id` `user_id` BIGINT(20) UNSIGNED NOT NULL" );
455
  }
456
 
457
  $activities_table = $wpdb->prefix . "ulike_activities";
461
  `activity_id` int(11) NOT NULL,
462
  `date_time` datetime NOT NULL,
463
  `ip` varchar(30) NOT NULL,
464
+ `user_id` bigint(20) UNSIGNED NOT NULL,
465
  `status` varchar(15) NOT NULL,
466
  PRIMARY KEY (`id`)
467
  );";
468
 
469
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
470
  dbDelta( $sql );
471
+ } else {
472
+ // Fix an old issue with user_id column
473
+ $wpdb->query( "ALTER TABLE $activities_table CHANGE `user_id` `user_id` BIGINT(20) UNSIGNED NOT NULL" );
474
  }
475
 
476
  $forums_table = $wpdb->prefix . "ulike_forums";
480
  `topic_id` int(11) NOT NULL,
481
  `date_time` datetime NOT NULL,
482
  `ip` varchar(30) NOT NULL,
483
+ `user_id` bigint(20) UNSIGNED NOT NULL,
484
  `status` varchar(15) NOT NULL,
485
  PRIMARY KEY (`id`)
486
  );";
487
 
488
  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
489
  dbDelta( $sql );
490
+ } else {
491
+ // Fix an old issue with user_id column
492
+ $wpdb->query( "ALTER TABLE $forums_table CHANGE `user_id` `user_id` BIGINT(20) UNSIGNED NOT NULL" );
493
  }
494
 
495
+ update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
496
+
497
  }
498
 
499
  do_action( 'wp_ulike_activated', get_current_blog_id() );