wpForo Forum - Version 2.0.9

Version Description

Download this release

Release Info

Developer Tomdever
Plugin Icon 128x128 wpForo Forum
Version 2.0.9
Comparing to
See all releases

Code changes from version 2.0.8 to 2.0.9

classes/Actions.php CHANGED
@@ -749,7 +749,9 @@ class Actions {
749
  $forumid = intval( wpfval( $_POST['topic_move'], 'forumid' ) );
750
  if( $topicid && $forumid ) {
751
  WPF()->topic->move( $topicid, $forumid );
752
- wp_safe_redirect( WPF()->topic->get_topic_url( $topicid ) );
 
 
753
  exit();
754
  }
755
  }
@@ -771,7 +773,8 @@ class Actions {
771
  $to_target_title = ( empty( $_POST['wpforo']['to_target_title'] ) ? 0 : 1 );
772
 
773
  if( WPF()->topic->merge( $target, WPF()->current_object['topic'], [], $to_target_title, $append ) ) {
774
- $redirect_to = WPF()->topic->get_topic_url( $target );
 
775
  }
776
  } else {
777
  WPF()->notice->add( 'Target Topic not found', 'error' );
@@ -1122,6 +1125,10 @@ class Actions {
1122
 
1123
  WPF()->member->clear_db_cache();
1124
  wpforo_clean_cache();
 
 
 
 
1125
  WPF()->notice->add( 'Deleted Successfully!', 'success' );
1126
 
1127
  $redirect = ( is_admin() ) ? admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) ) : wpforo_home_url();
749
  $forumid = intval( wpfval( $_POST['topic_move'], 'forumid' ) );
750
  if( $topicid && $forumid ) {
751
  WPF()->topic->move( $topicid, $forumid );
752
+ $url = WPF()->topic->get_topic_url( $topicid, [], false );
753
+ wpforo_clean_cache();
754
+ wp_safe_redirect( $url );
755
  exit();
756
  }
757
  }
773
  $to_target_title = ( empty( $_POST['wpforo']['to_target_title'] ) ? 0 : 1 );
774
 
775
  if( WPF()->topic->merge( $target, WPF()->current_object['topic'], [], $to_target_title, $append ) ) {
776
+ $redirect_to = WPF()->topic->get_topic_url( $target, [], false );
777
+ wpforo_clean_cache();
778
  }
779
  } else {
780
  WPF()->notice->add( 'Target Topic not found', 'error' );
1125
 
1126
  WPF()->member->clear_db_cache();
1127
  wpforo_clean_cache();
1128
+
1129
+ // Flush WordPress Cache
1130
+ wp_cache_flush();
1131
+
1132
  WPF()->notice->add( 'Deleted Successfully!', 'success' );
1133
 
1134
  $redirect = ( is_admin() ) ? admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) ) : wpforo_home_url();
classes/Cache.php CHANGED
@@ -18,6 +18,7 @@ class Cache {
18
  if( ! is_dir( $cache_dir ) ) $this->dir( $cache_dir );
19
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'tag' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'tag' );
20
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag' );
 
21
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option' );
22
 
23
  $this->dir = $cache_dir;
@@ -61,6 +62,7 @@ class Cache {
61
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'topic',
62
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'post',
63
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag',
 
64
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option',
65
  ];
66
  $this->mkdir( $dirs );
@@ -80,7 +82,7 @@ class Cache {
80
 
81
  public function get( $key, $type = 'loop', $template = null ) {
82
  $template = ( $template ) ?: WPF()->current_object['template'];
83
- $loop_templates = [ 'forum', 'topic', 'post', 'tag', 'option' ];
84
  if( $type === 'loop' && $template ) {
85
  if( $this->exists( $key, $template ) ) {
86
  if( in_array( $template, $loop_templates ) ) {
@@ -93,13 +95,12 @@ class Cache {
93
  }
94
  }
95
 
96
- public function get_item( $id, $type = 'post' ) {
97
  if( $id ) {
98
  $key = $id . '_' . $this->lang;
99
- if( $this->exists( $key, 'item', $type ) ) {
100
- $cache_file = $this->dir . '/item/' . $type . '/' . $key;
101
  $array = wpforo_get_file_content( $cache_file );
102
-
103
  return @unserialize( $array );
104
  }
105
  }
@@ -223,31 +224,35 @@ class Cache {
223
  if( $template === 'forum' || $template === 'forum-soft' ) {
224
  $id = isset( $id ) ? $id : $forumid;
225
  if( $template === 'forum' ) {
226
- $dirs = [ $this->dir . '/forum', $this->dir . '/item/forum' ];
227
  WPF()->seo->clear_cache();
228
- } elseif( $template === 'forum-soft' ) {
 
229
  $dirs = [ $this->dir . '/forum' ];
230
  }
231
  if( $id ) {
232
  $file = $this->dir . '/item/forum/' . $id . '_' . $this->lang;
233
  $this->clean_file( $file );
234
  }
235
- } elseif( $template === 'topic' || $template === 'topic-soft' ) {
236
  $id = isset( $id ) ? $id : $topicid;
237
- if( $template === 'topic' ) {
238
  WPF()->seo->clear_cache();
239
- $dirs = [ $this->dir . '/forum', $this->dir . '/item/forum', $this->dir . '/topic', $this->dir . '/post' ];
240
  }
241
- if( $template === 'topic-soft' && $forumid ) {
242
  $file = $this->dir . '/item/forum/' . $forumid . '_' . $this->lang;
243
  $this->clean_file( $file );
244
  }
245
  if( $id ) {
246
- $file = $this->dir . '/item/topic/' . $id . '_' . $this->lang;
247
  $this->clean_file( $file );
248
- $postid = ( isset( $item['first_postid'] ) && $item['first_postid'] ) ? $item['first_postid'] : 0;
 
 
249
  if( $postid ) $file = $this->dir . '/item/post/' . $postid . '_' . $this->lang;
250
  $this->clean_file( $file );
 
251
  }
252
  WPF()->statistic_cache_clean();
253
  $this->clear_visitor_tracking();
@@ -275,6 +280,9 @@ class Cache {
275
  if( $id ) {
276
  $file = $this->dir . '/item/post/' . $id . '_' . $this->lang;
277
  $this->clean_file( $file );
 
 
 
278
  }
279
  WPF()->statistic_cache_clean();
280
  $this->clear_visitor_tracking();
@@ -287,6 +295,8 @@ class Cache {
287
  }
288
  } elseif( $template === 'option' ) {
289
  $dirs = [ $this->dir . '/item/option/' ];
 
 
290
  } elseif( $template === 'user' ) {
291
  if( wpforo_setting( 'seo', 'seo_profile' ) ) WPF()->seo->clear_cache();
292
  } elseif( $template === 'loop' ) {
@@ -296,7 +306,7 @@ class Cache {
296
  $dirs = [ $this->dir . '/item/post', $this->dir . '/item/topic', $this->dir . '/item/forum' ];
297
  WPF()->seo->clear_cache();
298
  } else {
299
- $dirs = [ $this->dir . '/forum', $this->dir . '/topic', $this->dir . '/post', $this->dir . '/tag', $this->dir . '/item/post', $this->dir . '/item/topic', $this->dir . '/item/forum', $this->dir . '/item/tag', $this->dir . '/item/option/' ];
300
  WPF()->seo->clear_cache();
301
  }
302
 
@@ -305,7 +315,6 @@ class Cache {
305
  $this->clean_files( $dir );
306
  }
307
  }
308
-
309
  }
310
 
311
  public function clean_files( $directory ) {
@@ -328,9 +337,31 @@ class Cache {
328
  }
329
  }
330
 
331
- public function exists( $key, $template, $type = '' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  $type = ( $type ) ? $type . '/' : '';
333
- if( file_exists( $this->dir . '/' . $template . '/' . $type . $key ) ) {
334
  return true;
335
  } else {
336
  return false;
18
  if( ! is_dir( $cache_dir ) ) $this->dir( $cache_dir );
19
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'tag' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'tag' );
20
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag' );
21
+ if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'url' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'url' );
22
  if( ! is_dir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option' ) ) $this->mkdir( $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option' );
23
 
24
  $this->dir = $cache_dir;
62
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'topic',
63
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'post',
64
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'tag',
65
+ $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'url',
66
  $cache_dir . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR . 'option',
67
  ];
68
  $this->mkdir( $dirs );
82
 
83
  public function get( $key, $type = 'loop', $template = null ) {
84
  $template = ( $template ) ?: WPF()->current_object['template'];
85
+ $loop_templates = [ 'forum', 'topic', 'post', 'tag', 'url', 'option' ];
86
  if( $type === 'loop' && $template ) {
87
  if( $this->exists( $key, $template ) ) {
88
  if( in_array( $template, $loop_templates ) ) {
95
  }
96
  }
97
 
98
+ public function get_item( $id, $type = 'post', $sub_type = '' ) {
99
  if( $id ) {
100
  $key = $id . '_' . $this->lang;
101
+ if( $this->exists( $key, 'item', $type, $sub_type ) ) {
102
+ $cache_file = $this->dir . '/item/' . $type . '/' . ( $sub_type ? $sub_type . '_' : '' ) . $key;
103
  $array = wpforo_get_file_content( $cache_file );
 
104
  return @unserialize( $array );
105
  }
106
  }
224
  if( $template === 'forum' || $template === 'forum-soft' ) {
225
  $id = isset( $id ) ? $id : $forumid;
226
  if( $template === 'forum' ) {
227
+ $dirs = [ $this->dir . '/forum', $this->dir . '/item/forum', $this->dir . '/item/url' ];
228
  WPF()->seo->clear_cache();
229
+ }
230
+ if( $template === 'forum-soft' ) {
231
  $dirs = [ $this->dir . '/forum' ];
232
  }
233
  if( $id ) {
234
  $file = $this->dir . '/item/forum/' . $id . '_' . $this->lang;
235
  $this->clean_file( $file );
236
  }
237
+ } elseif( $template === 'topic' || $template === 'topic-first-post' || $template === 'topic-soft' ) {
238
  $id = isset( $id ) ? $id : $topicid;
239
+ if( $template === 'topic' || $template === 'topic-first-post' ) {
240
  WPF()->seo->clear_cache();
241
+ $dirs = [ $this->dir . '/forum', $this->dir . '/topic', $this->dir . '/post' ];
242
  }
243
+ if( $forumid ) {
244
  $file = $this->dir . '/item/forum/' . $forumid . '_' . $this->lang;
245
  $this->clean_file( $file );
246
  }
247
  if( $id ) {
248
+ $file = $this->dir . '/item/topic/' . $id . '_' . $this->lang;
249
  $this->clean_file( $file );
250
+ $file = $this->dir . '/item/url/topic_' . $id . '_' . $this->lang;
251
+ $this->clean_file( $file );
252
+ $postid = ( isset( $item['first_postid'] ) && $item['first_postid'] ) ? $item['first_postid'] : 0;
253
  if( $postid ) $file = $this->dir . '/item/post/' . $postid . '_' . $this->lang;
254
  $this->clean_file( $file );
255
+ if( $template === 'topic' ) $this->clear_topic_posts_urls( $id );
256
  }
257
  WPF()->statistic_cache_clean();
258
  $this->clear_visitor_tracking();
280
  if( $id ) {
281
  $file = $this->dir . '/item/post/' . $id . '_' . $this->lang;
282
  $this->clean_file( $file );
283
+ $file = $this->dir . '/item/url/post_' . $id . '_' . $this->lang;
284
+ $this->clean_file( $file );
285
+ $this->clear_topic_next_posts_urls( $id, $topicid );
286
  }
287
  WPF()->statistic_cache_clean();
288
  $this->clear_visitor_tracking();
295
  }
296
  } elseif( $template === 'option' ) {
297
  $dirs = [ $this->dir . '/item/option/' ];
298
+ } elseif( $template === 'url' ) {
299
+ $dirs = [ $this->dir . '/item/url/' ];
300
  } elseif( $template === 'user' ) {
301
  if( wpforo_setting( 'seo', 'seo_profile' ) ) WPF()->seo->clear_cache();
302
  } elseif( $template === 'loop' ) {
306
  $dirs = [ $this->dir . '/item/post', $this->dir . '/item/topic', $this->dir . '/item/forum' ];
307
  WPF()->seo->clear_cache();
308
  } else {
309
+ $dirs = [ $this->dir . '/forum', $this->dir . '/topic', $this->dir . '/post', $this->dir . '/tag', $this->dir . '/item/post', $this->dir . '/item/topic', $this->dir . '/item/forum', $this->dir . '/item/tag', $this->dir . '/item/url', $this->dir . '/item/option/' ];
310
  WPF()->seo->clear_cache();
311
  }
312
 
315
  $this->clean_files( $dir );
316
  }
317
  }
 
318
  }
319
 
320
  public function clean_files( $directory ) {
337
  }
338
  }
339
 
340
+ public function clear_topic_posts_urls( $topicid ){
341
+ if( !$topicid ) return;
342
+ $post_ids = WPF()->db->get_results("SELECT `postid` FROM " . WPF()->tables->posts . " WHERE `topicid` = " . intval( $topicid ), ARRAY_A );
343
+ if( !empty( $post_ids ) ){
344
+ foreach( $post_ids as $post_id ){
345
+ $this->clean_file( $this->dir . '/item/post/' . $post_id['postid'] . '_' . $this->lang );
346
+ $this->clean_file( $this->dir . '/item/url/post_' . $post_id['postid'] . '_' . $this->lang );
347
+ }
348
+ }
349
+ }
350
+
351
+ public function clear_topic_next_posts_urls( $postid, $topicid ){
352
+ $topicid = ( $topicid ) ? : wpforo_post( $postid, 'topicid' );
353
+ $post_ids = WPF()->db->get_results("SELECT `postid` FROM " . WPF()->tables->posts . " WHERE `topicid` = " . intval( $topicid ) . " AND `postid` > " . intval( $postid ), ARRAY_A );
354
+ if( !empty( $post_ids ) ){
355
+ foreach( $post_ids as $post_id ){
356
+ $this->clean_file( $this->dir . '/item/post/' . $post_id['postid'] . '_' . $this->lang );
357
+ $this->clean_file( $this->dir . '/item/url/post_' . $post_id['postid'] . '_' . $this->lang );
358
+ }
359
+ }
360
+ }
361
+
362
+ public function exists( $key, $template, $type = '', $sub_type = '' ) {
363
  $type = ( $type ) ? $type . '/' : '';
364
+ if( file_exists( $this->dir . '/' . $template . '/' . $type . ( $sub_type ? $sub_type . '_' : '' ) . $key ) ) {
365
  return true;
366
  } else {
367
  return false;
classes/Forums.php CHANGED
@@ -388,7 +388,14 @@ class Forums {
388
  `last_post_date` = %s
389
  WHERE `forumid` IN(" . implode( ',', $parent_ids ) . ")";
390
  WPF()->db->query( WPF()->db->prepare( $sql, $last_topicid, $last_postid, $last_userid, $last_post_date ) );
391
- wpforo_clean_cache( 'forum' );
 
 
 
 
 
 
 
392
  }
393
  }
394
 
@@ -398,14 +405,37 @@ class Forums {
398
  $posts = WPF()->post->get_count( [ 'forumid' => $forumid, 'status' => 0, 'private' => 0 ] );
399
 
400
  if( false !== WPF()->db->update( WPF()->tables->forums, [ 'topics' => $topics, 'posts' => $posts ], [ 'forumid' => $forumid ], [ '%d', '%d' ], [ '%d' ] ) ) {
401
- wpforo_clean_cache( 'forum' );
402
-
 
 
 
 
 
403
  return true;
404
  }
405
 
406
  return false;
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  function _get_forum( $args ) {
410
  $forum = [];
411
  if( ! $args ) return $forum;
@@ -838,7 +868,7 @@ class Forums {
838
  $old_depth = $depth;
839
  if( isset( WPF()->current_object ) && isset( WPF()->current_object['forumid'] ) ) {
840
  if( $forumid === intval( WPF()->current_object['forumid']) ) {
841
- echo '<span class="wpf-dl-item wpf-dl-current"><span class="wpf-circle wpf-s" style="color: ' . $forum['color'] . '; display: inline-flex;"><i class="' . $forum['icon'] . '"></i></span><strong>' . esc_html( $name ) . '</strong></span>';
842
  } else {
843
  echo '<span class="wpf-dl-item"><a href="' . esc_url( wpforo_forum( $forumid, 'url' ) ) . '" ><span class="wpf-circle wpf-s" style="color: ' . $forum['color'] . '; display: inline-flex;"><i class="' . $forum['icon'] . '"></i></span>' . esc_html( $name ) . '</a></span>';
844
  }
388
  `last_post_date` = %s
389
  WHERE `forumid` IN(" . implode( ',', $parent_ids ) . ")";
390
  WPF()->db->query( WPF()->db->prepare( $sql, $last_topicid, $last_postid, $last_userid, $last_post_date ) );
391
+
392
+ $parent_ids = $this->get_parent_forumids_static( $forumid );
393
+ if( !empty( $parent_ids ) ){
394
+ foreach( $parent_ids as $parent_id ){
395
+ wpforo_clean_cache( 'forum-soft', $parent_id );
396
+ }
397
+ }
398
+ wpforo_clean_cache( 'forum-soft' );
399
  }
400
  }
401
 
405
  $posts = WPF()->post->get_count( [ 'forumid' => $forumid, 'status' => 0, 'private' => 0 ] );
406
 
407
  if( false !== WPF()->db->update( WPF()->tables->forums, [ 'topics' => $topics, 'posts' => $posts ], [ 'forumid' => $forumid ], [ '%d', '%d' ], [ '%d' ] ) ) {
408
+ $parent_ids = $this->get_parent_forumids_static($forumid);
409
+ if( !empty( $parent_ids ) ){
410
+ foreach( $parent_ids as $parent_id ){
411
+ wpforo_clean_cache( 'forum-soft', $parent_id );
412
+ }
413
+ }
414
+ wpforo_clean_cache( 'forum-soft' );
415
  return true;
416
  }
417
 
418
  return false;
419
  }
420
 
421
+ function get_parent_forumids_static( $forumid ){
422
+ $parent_ids = [];
423
+ $level_0 = wpforo_forum( $forumid );
424
+ if( wpfval( $level_0, 'parentid') ) {
425
+ $level_1 = wpforo_forum( $level_0['parentid'] );
426
+ $parent_ids[] = $level_1['forumid'];
427
+ if( wpfval( $level_1, 'parentid') ){
428
+ $level_2 = wpforo_forum( $level_1['parentid'] );
429
+ $parent_ids[] = $level_2['forumid'];
430
+ if( wpfval( $level_2, 'parentid') ){
431
+ $level_3 = wpforo_forum( $level_2['parentid'] );
432
+ $parent_ids[] = $level_3['forumid'];
433
+ }
434
+ }
435
+ }
436
+ return $parent_ids;
437
+ }
438
+
439
  function _get_forum( $args ) {
440
  $forum = [];
441
  if( ! $args ) return $forum;
868
  $old_depth = $depth;
869
  if( isset( WPF()->current_object ) && isset( WPF()->current_object['forumid'] ) ) {
870
  if( $forumid === intval( WPF()->current_object['forumid']) ) {
871
+ echo '<span class="wpf-dl-item wpf-dl-current"><a href="' . esc_url( wpforo_forum( $forumid, 'url' ) ) . '" ><span class="wpf-circle wpf-s" style="color: ' . $forum['color'] . '; display: inline-flex;"><i class="' . $forum['icon'] . '"></i></span><strong style="color:#666;">' . esc_html( $name ) . '</strong></a></span>';
872
  } else {
873
  echo '<span class="wpf-dl-item"><a href="' . esc_url( wpforo_forum( $forumid, 'url' ) ) . '" ><span class="wpf-circle wpf-s" style="color: ' . $forum['color'] . '; display: inline-flex;"><i class="' . $forum['icon'] . '"></i></span>' . esc_html( $name ) . '</a></span>';
874
  }
classes/Members.php CHANGED
@@ -3573,4 +3573,47 @@ class Members {
3573
  }
3574
  return WPF()->user_trailingslashit( $url );
3575
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3576
  }
3573
  }
3574
  return WPF()->user_trailingslashit( $url );
3575
  }
3576
+
3577
+ public function get_newest_member( $status_filter = true ){
3578
+
3579
+ $groupids = implode( ", ", WPF()->usergroup->get_visible_usergroup_ids() );
3580
+
3581
+ if( $status_filter ){
3582
+ $status = implode( "', '", $this->get_inlist_enabled_statuses() );
3583
+ $sql = "SELECT `userid` FROM `". WPF()->tables->profiles ."`
3584
+ WHERE `status` IN ('" . $status . "')
3585
+ AND `groupid` IN (" . $groupids . ")
3586
+ ORDER BY `userid` DESC";
3587
+ } else {
3588
+ $sql = "SELECT `userid` FROM `". WPF()->tables->profiles ."`
3589
+ WHERE `groupid` IN (" . $groupids . ")
3590
+ ORDER BY `userid` DESC";
3591
+ }
3592
+
3593
+ $memberid = WPF()->db->get_var( $sql );
3594
+ $member = wpforo_member( $memberid );
3595
+
3596
+ if( empty( $member ) ){
3597
+
3598
+ WPF()->db->query("DELETE p FROM `". WPF()->tables->profiles ."` p LEFT JOIN `". WPF()->db->users ."` u ON u.ID = p.userid WHERE u.ID IS NULL");
3599
+
3600
+ $memberid = WPF()->db->get_var( $sql );
3601
+ $member = wpforo_member( $memberid );
3602
+
3603
+ if( empty( $member ) ){
3604
+ if( $status_filter ){
3605
+ $members = $this->get_members( [ 'orderby' => 'userid', 'status' => [ 'active' ], 'order' => 'DESC', 'row_count' => 1, 'groupids' => WPF()->usergroup->get_visible_usergroup_ids() ] );
3606
+ } else {
3607
+ $members = $this->get_members( [ 'orderby' => 'userid', 'order' => 'DESC', 'row_count' => 1, 'groupids' => WPF()->usergroup->get_visible_usergroup_ids() ] );
3608
+ }
3609
+ if( isset( $members[0] ) && ! empty( $members[0] ) ) {
3610
+ $member = $members[0];
3611
+ } else {
3612
+ $member = [];
3613
+ }
3614
+ }
3615
+ }
3616
+ $member['profile_url'] = wpfval($member, 'profile_url') ? $member['profile_url'] : $this->get_profile_url( $memberid );
3617
+ return $member;
3618
+ }
3619
  }
classes/Posts.php CHANGED
@@ -1162,6 +1162,8 @@ class Posts {
1162
  *
1163
  */
1164
  function get_post_url( $arg ) {
 
 
1165
  if( isset( $arg ) && ! is_array( $arg ) ) {
1166
  $postid = wpforo_bigintval( $arg );
1167
  $post = $this->get_post( $postid, false );
@@ -1171,6 +1173,12 @@ class Posts {
1171
  }
1172
 
1173
  if( ! empty( $post ) && is_array( $post ) && ! empty( $postid ) ) {
 
 
 
 
 
 
1174
  $forum_slug = ( wpfval( $post, 'forumid' ) ) ? wpforo_forum( $post['forumid'], 'slug' ) : $this->get_forumslug_byid( $postid );
1175
  $topic_slug = ( wpfval( $post, 'topicid' ) ) ? wpforo_topic( $post['topicid'], 'slug' ) : $this->get_topicslug_byid( $postid );
1176
 
@@ -1180,7 +1188,9 @@ class Posts {
1180
  $items_per_page = $this->get_option_items_per_page( WPF()->forum->get_layout( $post['forumid'] ) );
1181
 
1182
  if( $position <= $items_per_page ) {
1183
- return wpforo_home_url( $url ) . "#post-" . wpforo_bigintval( $postid );
 
 
1184
  }
1185
  if( $position && $items_per_page ) {
1186
  $paged = (int) ceil( $position / $items_per_page );
@@ -1188,8 +1198,10 @@ class Posts {
1188
  $paged = 1;
1189
  }
1190
 
1191
- return wpforo_home_url( $url . "/" . wpforo_settings_get_slug( 'paged' ) . "/" . $paged ) . "#post-" . wpforo_bigintval( $postid );
1192
- }
 
 
1193
 
1194
  return wpforo_home_url();
1195
  }
1162
  *
1163
  */
1164
  function get_post_url( $arg ) {
1165
+ $cache = WPF()->cache->on();
1166
+
1167
  if( isset( $arg ) && ! is_array( $arg ) ) {
1168
  $postid = wpforo_bigintval( $arg );
1169
  $post = $this->get_post( $postid, false );
1173
  }
1174
 
1175
  if( ! empty( $post ) && is_array( $post ) && ! empty( $postid ) ) {
1176
+
1177
+ if( $cache ) {
1178
+ $post_url = WPF()->cache->get_item( $postid, 'url', 'post' );
1179
+ if( $post_url ) return $post_url;
1180
+ }
1181
+
1182
  $forum_slug = ( wpfval( $post, 'forumid' ) ) ? wpforo_forum( $post['forumid'], 'slug' ) : $this->get_forumslug_byid( $postid );
1183
  $topic_slug = ( wpfval( $post, 'topicid' ) ) ? wpforo_topic( $post['topicid'], 'slug' ) : $this->get_topicslug_byid( $postid );
1184
 
1188
  $items_per_page = $this->get_option_items_per_page( WPF()->forum->get_layout( $post['forumid'] ) );
1189
 
1190
  if( $position <= $items_per_page ) {
1191
+ $post_url = wpforo_home_url( $url ) . "#post-" . wpforo_bigintval( $postid );
1192
+ if( $cache ) WPF()->cache->create( 'item', [ 'post_' . intval( $postid ) => $post_url ], 'url' );
1193
+ return $post_url;
1194
  }
1195
  if( $position && $items_per_page ) {
1196
  $paged = (int) ceil( $position / $items_per_page );
1198
  $paged = 1;
1199
  }
1200
 
1201
+ $post_url = wpforo_home_url( $url . "/" . wpforo_settings_get_slug( 'paged' ) . "/" . $paged ) . "#post-" . wpforo_bigintval( $postid );
1202
+ if( $cache ) WPF()->cache->create( 'item', [ 'post_' . intval( $postid ) => $post_url ], 'url' );
1203
+ return $post_url;
1204
+ }
1205
 
1206
  return wpforo_home_url();
1207
  }
classes/Topics.php CHANGED
@@ -388,7 +388,7 @@ class Topics {
388
  ];
389
  do_action( 'wpforo_after_edit_topic', $a, $args, $forum );
390
 
391
- wpforo_clean_cache( 'topic', $topicid, $topic );
392
  WPF()->notice->add( 'Topic successfully updated', 'success' );
393
 
394
  return $topicid;
@@ -528,7 +528,7 @@ class Topics {
528
  }
529
  }
530
 
531
- if( $topic ) $topic['url'] = $this->get_topic_url( $topic );
532
 
533
  return $topic;
534
  }
@@ -909,6 +909,7 @@ class Topics {
909
  * @return bool true|false true on success, otherwise false
910
  */
911
  public function merge( $target, $current = [], $postids = [], $to_target_title = 0, $append = 0 ) {
 
912
  if( ! $current ) $current = WPF()->current_object['topic'];
913
 
914
  $sql = "UPDATE `" . WPF()->tables->posts . "` SET `topicid` = %d, `forumid` = %d, `private` = %d,`is_first_post` = 0";
@@ -1063,9 +1064,16 @@ class Topics {
1063
  return false;
1064
  }
1065
 
1066
- public function _get_topic_url( $topic, $forum = [] ) {
1067
  if( ! is_array( $topic ) ) $topic = $this->get_topic( $topic );
1068
  if( $topic ) {
 
 
 
 
 
 
 
1069
  if( is_array( $forum ) && ! empty( $forum ) ) {
1070
  $forum_slug = $forum['slug'];
1071
  } else {
@@ -1076,14 +1084,18 @@ class Topics {
1076
  $forum_slug = $this->get_forumslug_byid( $topic['topicid'] );
1077
  }
1078
  }
1079
- if( wpfval( $topic, 'slug' ) ) return wpforo_home_url( $forum_slug . '/' . $topic['slug'] );
 
 
 
 
1080
  }
1081
 
1082
  return wpforo_home_url();
1083
  }
1084
 
1085
- public function get_topic_url( $topic, $forum = [] ) {
1086
- return wpforo_ram_get( [ $this, '_get_topic_url' ], $topic, $forum );
1087
  }
1088
 
1089
 
@@ -1113,7 +1125,7 @@ class Topics {
1113
  }
1114
 
1115
  do_action( 'wpforo_topic_status_update', $topic, $status );
1116
- wpforo_clean_cache( 'topic', $topicid );
1117
  }
1118
 
1119
  if( $r !== false ){
@@ -1163,7 +1175,7 @@ class Topics {
1163
  }
1164
 
1165
  if( $r = WPF()->db->update( WPF()->tables->topics, $data, [ 'topicid' => $topic['topicid'] ], $data_format, [ '%d' ] ) ) {
1166
- wpforo_clean_cache( 'topic', $topic['topicid'], $topic );
1167
  }
1168
 
1169
  return $r !== false;
@@ -1203,7 +1215,7 @@ class Topics {
1203
  [ '%d', '%d', '%s' ],
1204
  [ '%d' ]
1205
  ) ) {
1206
- wpforo_clean_cache( 'topic' );
1207
  }
1208
 
1209
  return $r !== false;
388
  ];
389
  do_action( 'wpforo_after_edit_topic', $a, $args, $forum );
390
 
391
+ wpforo_clean_cache( 'topic-first-post', $topicid, $topic );
392
  WPF()->notice->add( 'Topic successfully updated', 'success' );
393
 
394
  return $topicid;
528
  }
529
  }
530
 
531
+ if( $topic ) $topic['url'] = $this->get_topic_url( $topic, [], false );
532
 
533
  return $topic;
534
  }
909
  * @return bool true|false true on success, otherwise false
910
  */
911
  public function merge( $target, $current = [], $postids = [], $to_target_title = 0, $append = 0 ) {
912
+
913
  if( ! $current ) $current = WPF()->current_object['topic'];
914
 
915
  $sql = "UPDATE `" . WPF()->tables->posts . "` SET `topicid` = %d, `forumid` = %d, `private` = %d,`is_first_post` = 0";
1064
  return false;
1065
  }
1066
 
1067
+ public function _get_topic_url( $topic, $forum = [], $_cache = true ) {
1068
  if( ! is_array( $topic ) ) $topic = $this->get_topic( $topic );
1069
  if( $topic ) {
1070
+ $cache = WPF()->cache->on();
1071
+ // $_cache is used to stop caching on merge and move actions,
1072
+ // otherwise the merging and splitting go to redirection loop
1073
+ if( $_cache && $cache && wpfval($topic, 'topicid') ) {
1074
+ $topic_url = WPF()->cache->get_item( $topic['topicid'], 'url', 'topic' );
1075
+ if( $topic_url ) return $topic_url;
1076
+ }
1077
  if( is_array( $forum ) && ! empty( $forum ) ) {
1078
  $forum_slug = $forum['slug'];
1079
  } else {
1084
  $forum_slug = $this->get_forumslug_byid( $topic['topicid'] );
1085
  }
1086
  }
1087
+ if( wpfval( $topic, 'slug' ) ) {
1088
+ $topic_url = wpforo_home_url( $forum_slug . '/' . $topic['slug'] );
1089
+ if( $cache ) WPF()->cache->create( 'item', [ 'topic_' . intval( $topic['topicid'] ) => $topic_url ], 'url' );
1090
+ return $topic_url;
1091
+ }
1092
  }
1093
 
1094
  return wpforo_home_url();
1095
  }
1096
 
1097
+ public function get_topic_url( $topic, $forum = [], $_cache = true ) {
1098
+ return wpforo_ram_get( [ $this, '_get_topic_url' ], $topic, $forum, $_cache );
1099
  }
1100
 
1101
 
1125
  }
1126
 
1127
  do_action( 'wpforo_topic_status_update', $topic, $status );
1128
+ wpforo_clean_cache( 'topic-first-post', $topicid );
1129
  }
1130
 
1131
  if( $r !== false ){
1175
  }
1176
 
1177
  if( $r = WPF()->db->update( WPF()->tables->topics, $data, [ 'topicid' => $topic['topicid'] ], $data_format, [ '%d' ] ) ) {
1178
+ wpforo_clean_cache( 'topic-first-post', $topic['topicid'], $topic );
1179
  }
1180
 
1181
  return $r !== false;
1215
  [ '%d', '%d', '%s' ],
1216
  [ '%d' ]
1217
  ) ) {
1218
+ wpforo_clean_cache( 'topic-first-post' );
1219
  }
1220
 
1221
  return $r !== false;
includes/functions-template.php CHANGED
@@ -1703,7 +1703,7 @@ function wpforo_check_threads( $posts = [] ) {
1703
  if( wpfkey( $post, 'root' ) ) {
1704
  if( is_null( $post['root'] ) && wpfval( $post, 'topicid' ) ) {
1705
  WPF()->topic->rebuild_threads( $post['topicid'] );
1706
- wpforo_clean_cache();
1707
  }
1708
  }
1709
  }
1703
  if( wpfkey( $post, 'root' ) ) {
1704
  if( is_null( $post['root'] ) && wpfval( $post, 'topicid' ) ) {
1705
  WPF()->topic->rebuild_threads( $post['topicid'] );
1706
+ wpforo_clean_cache( 'topic', $post['topicid'] );
1707
  }
1708
  }
1709
  }
includes/hooks.php CHANGED
@@ -679,7 +679,7 @@ function wpf_sticky() {
679
  if( $status === 'sticky' ) {
680
  $sql = "UPDATE `" . WPF()->tables->topics . "` SET `type` = 1 WHERE `topicid` = $topicid";
681
  if( false !== WPF()->db->query( $sql ) ) {
682
- wpforo_clean_cache( 'topic', $topicid );
683
  WPF()->notice->add( 'Done!', 'success' );
684
  $response['notice'] = WPF()->notice->get_notices();
685
  wp_send_json_success( $response );
@@ -687,7 +687,7 @@ function wpf_sticky() {
687
  } elseif( $status === 'unsticky' ) {
688
  $sql = "UPDATE `" . WPF()->tables->topics . "` SET `type` = 0 WHERE `topicid` = $topicid";
689
  if( false !== WPF()->db->query( $sql ) ) {
690
- wpforo_clean_cache( 'topic', $topicid );
691
  WPF()->notice->add( 'Done!', 'success' );
692
  $response['notice'] = WPF()->notice->get_notices();
693
  wp_send_json_success( $response );
@@ -737,7 +737,7 @@ function wpf_solved() {
737
  $solved = ( wpfval( $_POST, 'status' ) === 'solved' ? 1 : 0 );
738
  $sql = "UPDATE " . WPF()->tables->topics . " SET `solved` = %d WHERE `topicid` = %d";
739
  WPF()->db->query( WPF()->db->prepare( $sql, $solved, $post['topicid'] ) );
740
- wpforo_clean_cache( 'topic', $post['topicid'] );
741
  wp_send_json_success();
742
  }
743
  }
@@ -779,12 +779,12 @@ function wpf_close() {
779
  if( $status === 'closed' ) {
780
  $sql = "UPDATE " . WPF()->tables->topics . " SET closed = 0 WHERE topicid = " . $topicid;
781
  WPF()->db->query( $sql );
782
- wpforo_clean_cache( 'topic', $topicid );
783
  wp_send_json_success();
784
  } elseif( $status === 'close' ) {
785
  $sql = "UPDATE " . WPF()->tables->topics . " SET closed = 1 WHERE topicid = " . $topicid;
786
  WPF()->db->query( $sql );
787
- wpforo_clean_cache( 'topic', $topicid );
788
  wp_send_json_success();
789
  }
790
  wp_send_json_error();
679
  if( $status === 'sticky' ) {
680
  $sql = "UPDATE `" . WPF()->tables->topics . "` SET `type` = 1 WHERE `topicid` = $topicid";
681
  if( false !== WPF()->db->query( $sql ) ) {
682
+ wpforo_clean_cache( 'topic-first-post', $topicid );
683
  WPF()->notice->add( 'Done!', 'success' );
684
  $response['notice'] = WPF()->notice->get_notices();
685
  wp_send_json_success( $response );
687
  } elseif( $status === 'unsticky' ) {
688
  $sql = "UPDATE `" . WPF()->tables->topics . "` SET `type` = 0 WHERE `topicid` = $topicid";
689
  if( false !== WPF()->db->query( $sql ) ) {
690
+ wpforo_clean_cache( 'topic-first-post', $topicid );
691
  WPF()->notice->add( 'Done!', 'success' );
692
  $response['notice'] = WPF()->notice->get_notices();
693
  wp_send_json_success( $response );
737
  $solved = ( wpfval( $_POST, 'status' ) === 'solved' ? 1 : 0 );
738
  $sql = "UPDATE " . WPF()->tables->topics . " SET `solved` = %d WHERE `topicid` = %d";
739
  WPF()->db->query( WPF()->db->prepare( $sql, $solved, $post['topicid'] ) );
740
+ wpforo_clean_cache( 'topic-first-post', $post['topicid'] );
741
  wp_send_json_success();
742
  }
743
  }
779
  if( $status === 'closed' ) {
780
  $sql = "UPDATE " . WPF()->tables->topics . " SET closed = 0 WHERE topicid = " . $topicid;
781
  WPF()->db->query( $sql );
782
+ wpforo_clean_cache( 'topic-first-post', $topicid );
783
  wp_send_json_success();
784
  } elseif( $status === 'close' ) {
785
  $sql = "UPDATE " . WPF()->tables->topics . " SET closed = 1 WHERE topicid = " . $topicid;
786
  WPF()->db->query( $sql );
787
+ wpforo_clean_cache( 'topic-first-post', $topicid );
788
  wp_send_json_success();
789
  }
790
  wp_send_json_error();
includes/installation.php CHANGED
@@ -70,7 +70,14 @@ function wpforo_activation() {
70
  // UPDATE VERSION - END /////////////////////////////////////////
71
  wpforo_update_option( 'version', WPFORO_VERSION );
72
  WPF()->notice->clear();
 
 
 
73
  wpforo_clean_cache();
 
 
 
 
74
  }
75
 
76
  function wpforo_upgrade(){
70
  // UPDATE VERSION - END /////////////////////////////////////////
71
  wpforo_update_option( 'version', WPFORO_VERSION );
72
  WPF()->notice->clear();
73
+
74
+ #################################################################
75
+ // DELETE ALL CAHCES /////////////////////////////////////////
76
  wpforo_clean_cache();
77
+ // At the moment only Redis Object Cache should be flushed because it causes 404 error for all forum pages.
78
+ if( function_exists( 'redis_object_cache' ) ) {
79
+ wp_cache_flush();
80
+ }
81
  }
82
 
83
  function wpforo_upgrade(){
modules/subscriptions/classes/Actions.php CHANGED
@@ -225,17 +225,19 @@ class Actions {
225
  $unsubscribe_link = '';
226
  }
227
 
228
- $key = 'topicid_' . $topic['topicid'] . '_user_email_' . $user['user_email'];
229
- if( ! WPF()->ram_cache->exists( $key ) ){
 
230
 
231
- if( wpforo_is_users_same( $owner, $user ) ) continue;
232
- if( wpforo_is_users_same( $user ) ) continue;
233
 
234
- $sbj_msg = WPF()->sbscrb->get_sbj_msg( 'new_topic', $forum, $topic, $owner, $user, $unsubscribe_link );
235
- wpforo_send_email( $user['user_email'], $sbj_msg['sbj'], $sbj_msg['msg'] );
236
 
237
- WPF()->ram_cache->set( $key, true );
238
- }
 
239
  }
240
  }
241
 
225
  $unsubscribe_link = '';
226
  }
227
 
228
+ if( wpfval($user, 'user_email') ){
229
+ $key = 'topicid_' . $topic['topicid'] . '_user_email_' . $user['user_email'];
230
+ if( ! WPF()->ram_cache->exists( $key ) ){
231
 
232
+ if( wpforo_is_users_same( $owner, $user ) ) continue;
233
+ if( wpforo_is_users_same( $user ) ) continue;
234
 
235
+ $sbj_msg = WPF()->sbscrb->get_sbj_msg( 'new_topic', $forum, $topic, $owner, $user, $unsubscribe_link );
236
+ wpforo_send_email( $user['user_email'], $sbj_msg['sbj'], $sbj_msg['msg'] );
237
 
238
+ WPF()->ram_cache->set( $key, true );
239
+ }
240
+ }
241
  }
242
  }
243
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 5.1
5
  Tested up to: 6.0
6
- Stable tag: 2.0.8
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -163,7 +163,7 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
163
 
164
  == Changelog ==
165
 
166
- = wpForo Forum 2.0.1 - 2.0.8 | 03.08.2022 - 12.09.2022 =
167
 
168
  [wpForo Forum v2.0 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-2-0-1-is-released/)
169
 
@@ -173,12 +173,21 @@ IMPORTANT NOTES for UPDATE
173
  - Deactivate Go2wpForo tool if you have installed and done forum migration
174
  - This is a major update with fully changed forum theme. This update will remove forum template and css customizations. Also, some settings might be reset and you may need to update them again.
175
  - Make sure you don't have old forum template files in /wpforo/ folder of your current active theme directory.
176
- - After the update, please delete all caches and purge CDN if you have.
 
177
  - Please read [Update to wpForo v2 Instruction](https://wpforo.com/docs/wpforo-v2/getting-started/update-to-wpforo-v2/)
178
  - In case the update has been done automatically and your website is crashed please use [these solutions](https://wpforo.com/community/postid/68095/)
179
 
180
  ADDED FEATURES and FIXED BUGS
181
 
 
 
 
 
 
 
 
 
182
  * Version 2.0.8
183
  * Added: Nickname on the profile page
184
  * Added: More types of problem detection in Debug > Error & Issues Tab
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 5.1
5
  Tested up to: 6.0
6
+ Stable tag: 2.0.9
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
163
 
164
  == Changelog ==
165
 
166
+ = wpForo Forum 2.0.1 - 2.0.9 | 03.08.2022 - 18.09.2022 =
167
 
168
  [wpForo Forum v2.0 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-2-0-1-is-released/)
169
 
173
  - Deactivate Go2wpForo tool if you have installed and done forum migration
174
  - This is a major update with fully changed forum theme. This update will remove forum template and css customizations. Also, some settings might be reset and you may need to update them again.
175
  - Make sure you don't have old forum template files in /wpforo/ folder of your current active theme directory.
176
+ - After the update, please delete all caches and purge CDN if you have
177
+ - After the update, please flush Redis Object Cache if you have this cache enabled
178
  - Please read [Update to wpForo v2 Instruction](https://wpforo.com/docs/wpforo-v2/getting-started/update-to-wpforo-v2/)
179
  - In case the update has been done automatically and your website is crashed please use [these solutions](https://wpforo.com/community/postid/68095/)
180
 
181
  ADDED FEATURES and FIXED BUGS
182
 
183
+ * Version 2.0.9
184
+ * Core: SQL Optimization
185
+ * Core: More caching items (forum, topic, post URL caching)
186
+ * Core: Better built-in cache, better cache deleting control
187
+ * Core: Flush Redis Object Cache on activation
188
+ * Added: Clickable current forum link in the forums widget
189
+ * Fixed Bug: PHP Warning: trying to access key on null, line 228 / 235
190
+ * --------
191
  * Version 2.0.8
192
  * Added: Nickname on the profile page
193
  * Added: More types of problem detection in Debug > Error & Issues Tab
themes/2022/layouts/4/post.php CHANGED
@@ -107,7 +107,7 @@
107
  <div class="wpf-post-replies-bar" id="wpf-ttgg-<?php echo intval($post['postid']); ?>">
108
  <div class="wpf-post-replies-info">
109
  <i class="far fa-comments"></i>
110
- <span class="wpf-post-replies-title"><?php ( (int) $reply_count > 2 ) ? printf( wpforo_phrase('%s Replies', false), wpforo_print_number($reply_count) ) : printf( wpforo_phrase('%s Reply', false), wpforo_print_number($reply_count) ); ?></span>
111
  </div>
112
  <div class="wpf-prsep"></div>
113
  <div wpf-tooltip="<?php wpforo_phrase('Hide replies') ?>" class="wpforo-ttgg"><i class="fas fa-angle-up"></i></div>
107
  <div class="wpf-post-replies-bar" id="wpf-ttgg-<?php echo intval($post['postid']); ?>">
108
  <div class="wpf-post-replies-info">
109
  <i class="far fa-comments"></i>
110
+ <span class="wpf-post-replies-title"><?php ( (int) $reply_count > 1 ) ? printf( wpforo_phrase('%s Replies', false), wpforo_print_number($reply_count) ) : printf( wpforo_phrase('%s Reply', false), wpforo_print_number($reply_count) ); ?></span>
111
  </div>
112
  <div class="wpf-prsep"></div>
113
  <div wpf-tooltip="<?php wpforo_phrase('Hide replies') ?>" class="wpforo-ttgg"><i class="fas fa-angle-up"></i></div>
themes/2022/style-rtl.css CHANGED
@@ -983,7 +983,7 @@ RTL Style of Classic Theme
983
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data{width: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; flex-grow: 1; padding-right: 10px; padding-top: 22px;}
984
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details{ background-color: #fff; padding: 3px 20px; opacity: 0.8; max-width: 50%; border-radius: 7px; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start;}
985
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details .wpfp-name{ font-size: 16px; font-weight: 600; color: #333;}
986
- #wpforo #wpforo-wrap .wpforo-profile .wpf-profile-details .wpfp-name .wpf-author-nicename {display: inline-block;border-right: 2px solid #bbb; font-weight: normal; padding-right: 8px; margin-right: 6px; line-height: 20px; vertical-align: text-top; color: #111; font-size: 15px;}
987
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpfp-box{padding-left: 16px; margin-left: 0;}
988
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-head-right{display: flex; justify-content: flex-end; align-items: flex-end;}
989
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpf-edit-cover{font-size: 20px; padding: 0 4px; margin: 0; line-height: 18px; color: #555; cursor: pointer;}
983
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data{width: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; flex-grow: 1; padding-right: 10px; padding-top: 22px;}
984
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details{ background-color: #fff; padding: 3px 20px; opacity: 0.8; max-width: 50%; border-radius: 7px; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start;}
985
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details .wpfp-name{ font-size: 16px; font-weight: 600; color: #333;}
986
+ #wpforo #wpforo-wrap .wpforo-profile .wpf-profile-details .wpfp-name .wpf-author-nicename {display: inline-block;border-right: 2px solid #bbb; font-weight: normal; padding-right: 8px; margin-right: 6px; line-height: 20px; vertical-align: initial; color: #111; font-size: 15px;}
987
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpfp-box{padding-left: 16px; margin-left: 0;}
988
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-head-right{display: flex; justify-content: flex-end; align-items: flex-end;}
989
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpf-edit-cover{font-size: 20px; padding: 0 4px; margin: 0; line-height: 18px; color: #555; cursor: pointer;}
themes/2022/style.css CHANGED
@@ -989,7 +989,7 @@ Author: gVectors Team
989
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data{width: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; flex-grow: 1; padding-left: 10px; padding-top: 22px;}
990
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details{ background-color: #fff; padding: 3px 20px; opacity: 0.8; max-width: 50%; border-radius: 7px; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start;}
991
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details .wpfp-name{ font-size: 16px; font-weight: 600; color: #333;}
992
- #wpforo #wpforo-wrap .wpforo-profile .wpf-profile-details .wpfp-name .wpf-author-nicename {display: inline-block;border-left: 2px solid #bbb; font-weight: normal; padding-left: 8px; margin-left: 6px; line-height: 20px; vertical-align: text-top; color: #111; font-size: 15px;}
993
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpfp-box{padding-right: 16px; margin-right: 0;}
994
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-head-right{display: flex; justify-content: flex-end; align-items: flex-end;}
995
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpf-edit-cover{font-size: 20px; padding: 0 4px; margin: 0; line-height: 18px; color: #555; cursor: pointer;}
989
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data{width: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; flex-grow: 1; padding-left: 10px; padding-top: 22px;}
990
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details{ background-color: #fff; padding: 3px 20px; opacity: 0.8; max-width: 50%; border-radius: 7px; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start;}
991
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-details .wpfp-name{ font-size: 16px; font-weight: 600; color: #333;}
992
+ #wpforo #wpforo-wrap .wpforo-profile .wpf-profile-details .wpfp-name .wpf-author-nicename {display: inline-block;border-left: 2px solid #bbb; font-weight: normal; padding-left: 8px; margin-left: 6px; line-height: 20px; vertical-align: initial; color: #111; font-size: 15px;}
993
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpfp-box{padding-right: 16px; margin-right: 0;}
994
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpforo-profile-head-data .wpf-profile-head-right{display: flex; justify-content: flex-end; align-items: flex-end;}
995
  #wpforo #wpforo-wrap .wpforo-profile .wpforo-profile-head-panel .wpf-edit-cover{font-size: 20px; padding: 0 4px; margin: 0; line-height: 18px; color: #555; cursor: pointer;}
wpforo.php CHANGED
@@ -5,14 +5,14 @@
5
  * Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
- * Version: 2.0.8
9
  * Text Domain: wpforo
10
  * Domain Path: /languages
11
  */
12
 
13
  namespace wpforo;
14
 
15
- define( 'WPFORO_VERSION', '2.0.8' );
16
 
17
  //Exit if accessed directly
18
  if( ! defined( 'ABSPATH' ) ) exit;
@@ -735,13 +735,12 @@ final class wpforo {
735
  $stats['last_post_url'] = $this->post->get_post_url( $posts[ $first ]['last_post'] );
736
  }
737
 
738
- $members = $this->member->get_members( [ 'orderby' => 'userid', 'status' => [ 'active' ], 'order' => 'DESC', 'row_count' => 1, 'groupids' => $this->usergroup->get_visible_usergroup_ids() ] );
739
- if( isset( $members[0] ) && ! empty( $members[0] ) ) {
740
- $members[0]['profile_url'] = $this->member->get_profile_url( $members[0] );
741
- $stats['newest_member'] = $members[0];
742
- $stats['newest_member_dname'] = wpforo_user_dname( $members[0] );
743
- $stats['newest_member_profile_url'] = $members[0]['profile_url'];
744
- }
745
  } else {
746
  $stats = wpforo_get_option( $key, $this->default->stats, false );
747
  switch( $template ) {
@@ -765,17 +764,17 @@ final class wpforo {
765
  }
766
  break;
767
  case 'user':
768
- $member_status = [ 'p.`status`' => $this->member->get_inlist_enabled_statuses() ];
769
- $stats['members'] = $this->member->get_count( $member_status );
 
770
  $stats['online_members_count'] = $this->member->online_members_count();
771
 
772
- $members = $this->member->get_members( [ 'orderby' => 'userid', 'order' => 'DESC', 'row_count' => 1, 'groupids' => $this->usergroup->get_visible_usergroup_ids() ] );
773
- if( isset( $members[0] ) && ! empty( $members[0] ) ) {
774
- $members[0]['profile_url'] = $this->member->get_profile_url( $members[0] );
775
- $stats['newest_member'] = $members[0];
776
- $stats['newest_member_dname'] = wpforo_user_dname( $members[0] );
777
- $stats['newest_member_profile_url'] = $members[0]['profile_url'];
778
- }
779
  break;
780
  }
781
  }
5
  * Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
+ * Version: 2.0.9
9
  * Text Domain: wpforo
10
  * Domain Path: /languages
11
  */
12
 
13
  namespace wpforo;
14
 
15
+ define( 'WPFORO_VERSION', '2.0.9' );
16
 
17
  //Exit if accessed directly
18
  if( ! defined( 'ABSPATH' ) ) exit;
735
  $stats['last_post_url'] = $this->post->get_post_url( $posts[ $first ]['last_post'] );
736
  }
737
 
738
+ $newest_member = $this->member->get_newest_member();
739
+ if( !empty( $newest_member ) ){
740
+ $stats['newest_member'] = $newest_member;
741
+ $stats['newest_member_dname'] = wpforo_user_dname( $newest_member );
742
+ $stats['newest_member_profile_url'] = $newest_member['profile_url'];
743
+ }
 
744
  } else {
745
  $stats = wpforo_get_option( $key, $this->default->stats, false );
746
  switch( $template ) {
764
  }
765
  break;
766
  case 'user':
767
+ //$member_status = [ 'p.`status`' => $this->member->get_inlist_enabled_statuses() ];
768
+ //$stats['members'] = $this->member->get_count( $member_status );
769
+ $stats['members'] = $this->member->get_count();
770
  $stats['online_members_count'] = $this->member->online_members_count();
771
 
772
+ $newest_member = $this->member->get_newest_member( false );
773
+ if( !empty( $newest_member ) ){
774
+ $stats['newest_member'] = $newest_member;
775
+ $stats['newest_member_dname'] = wpforo_user_dname( $newest_member );
776
+ $stats['newest_member_profile_url'] = $newest_member['profile_url'];
777
+ }
 
778
  break;
779
  }
780
  }