wpForo Forum - Version 2.1.2

Version Description

Download this release

Release Info

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

Code changes from version 2.1.1 to 2.1.2

admin/pages/usergroup.php CHANGED
@@ -383,7 +383,7 @@ $wpfaction = wpfval( $_GET, 'wpfaction' );
383
  <input type="checkbox" name="usergroup[visible]" value="1" <?php echo $group['visible'] ? 'checked' : '' ?>>
384
  <?php _e( 'Display on Members List', 'wpforo' ) ?>
385
  </label>
386
- <?php if( in_array( $group['groupid'], [ 1, 4 ] ) ): ?>
387
  <input type="hidden" name="usergroup[secondary]" value="0">
388
  <?php else: ?>
389
  <label>
383
  <input type="checkbox" name="usergroup[visible]" value="1" <?php echo $group['visible'] ? 'checked' : '' ?>>
384
  <?php _e( 'Display on Members List', 'wpforo' ) ?>
385
  </label>
386
+ <?php if( in_array( $group['groupid'], [ 1, 2, 4 ] ) ): ?>
387
  <input type="hidden" name="usergroup[secondary]" value="0">
388
  <?php else: ?>
389
  <label>
assets/js/ajax.js CHANGED
@@ -711,7 +711,7 @@ $wpf(document).ready(function ($) {
711
  wpforo_trigger_custom_event(document, 'wpforo_topic_portable_form', f);
712
  }
713
  f.fadeIn('slow');
714
- // $( 'html, body' ).animate({scrollTop: (wrap.offset().top - 80)}, 415);
715
  $this.removeClass('wpf-processing');
716
  }
717
 
711
  wpforo_trigger_custom_event(document, 'wpforo_topic_portable_form', f);
712
  }
713
  f.fadeIn('slow');
714
+ $( 'html, body' ).animate({scrollTop: (wrap.offset().top - 80)}, 415);
715
  $this.removeClass('wpf-processing');
716
  }
717
 
assets/js/frontend.js CHANGED
@@ -203,10 +203,25 @@ var wpforo_editor = {
203
  is_exists: function(textareaid){
204
  return !!( textareaid && this.is_tinymce(textareaid) || this.is_textarea(textareaid) );
205
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  tinymce_focus: function(textareaid, caret_to_end){
207
  textareaid = this.fix_textareaid(textareaid);
208
  if( this.is_tinymce(textareaid) ){
209
- $wpf('html, body').animate({ scrollTop: ( $wpf('form[data-textareaid="' + textareaid + '"]').offset().top - 300 ) }, 500);
210
  var focus_mce = tinymce.get(textareaid);
211
  focus_mce.focus();
212
  if(caret_to_end){
@@ -218,7 +233,7 @@ var wpforo_editor = {
218
  textarea_focus: function(textareaid, caret_to_end){
219
  textareaid = this.fix_textareaid(textareaid);
220
  if( this.is_textarea(textareaid) ){
221
- $wpf('html, body').animate({ scrollTop: ($wpf('form[data-textareaid="' + textareaid + '"]').offset().top - 300) }, 500);
222
  var textarea = $wpf( 'textarea#' + textareaid );
223
  var textarea_val = textarea.val();
224
  textarea.trigger("focus");
203
  is_exists: function(textareaid){
204
  return !!( textareaid && this.is_tinymce(textareaid) || this.is_textarea(textareaid) );
205
  },
206
+ get_form: function( textareaid ){
207
+ textareaid = this.fix_textareaid(textareaid);
208
+ var textarea = $wpf( 'textarea[id="' + textareaid + '"]' );
209
+ if( textarea.length ){
210
+ var form = textarea.closest( 'form' );
211
+ if( form.length ) return form;
212
+ }
213
+ return null;
214
+ },
215
+ scrollto: function( textareaid ){
216
+ var scrollto = null;
217
+ var form = this.get_form( textareaid );
218
+ if( form !== null ) scrollto = form.offset().top - 400;
219
+ if( scrollto !== null ) $wpf('html, body').animate({ scrollTop: scrollto }, 500);
220
+ },
221
  tinymce_focus: function(textareaid, caret_to_end){
222
  textareaid = this.fix_textareaid(textareaid);
223
  if( this.is_tinymce(textareaid) ){
224
+ this.scrollto( textareaid );
225
  var focus_mce = tinymce.get(textareaid);
226
  focus_mce.focus();
227
  if(caret_to_end){
233
  textarea_focus: function(textareaid, caret_to_end){
234
  textareaid = this.fix_textareaid(textareaid);
235
  if( this.is_textarea(textareaid) ){
236
+ this.scrollto( textareaid );
237
  var textarea = $wpf( 'textarea#' + textareaid );
238
  var textarea_val = textarea.val();
239
  textarea.trigger("focus");
classes/API.php CHANGED
@@ -878,7 +878,7 @@ class API {
878
  return $error;
879
  }
880
  $response = json_decode( $response['body'], true );
881
- if( $response['success'] == true ) {
882
  return 'success';
883
  } else {
884
  return wpforo_phrase( 'Google reCAPTCHA verification failed', false );
@@ -925,7 +925,7 @@ class API {
925
  }
926
  $errors = is_wp_error( $user ) ? $user : new WP_Error();
927
  $result = $this->rc_check();
928
- if( $result != 'success' ) {
929
  $errors->add( 'wpforo-recaptcha-error', $result );
930
  $user = is_wp_error( $user ) ? $user : $errors;
931
  remove_filter( 'authenticate', 'wp_authenticate_username_password' );
@@ -945,7 +945,7 @@ class API {
945
  }
946
  }
947
  $result = $this->rc_check();
948
- if( $result != 'success' ) {
949
  $errors->add( 'wpforo-recaptcha-error', $result );
950
  }
951
 
878
  return $error;
879
  }
880
  $response = json_decode( $response['body'], true );
881
+ if( $response['success'] ) {
882
  return 'success';
883
  } else {
884
  return wpforo_phrase( 'Google reCAPTCHA verification failed', false );
925
  }
926
  $errors = is_wp_error( $user ) ? $user : new WP_Error();
927
  $result = $this->rc_check();
928
+ if( $result !== 'success' ) {
929
  $errors->add( 'wpforo-recaptcha-error', $result );
930
  $user = is_wp_error( $user ) ? $user : $errors;
931
  remove_filter( 'authenticate', 'wp_authenticate_username_password' );
945
  }
946
  }
947
  $result = $this->rc_check();
948
+ if( $result !== 'success' ) {
949
  $errors->add( 'wpforo-recaptcha-error', $result );
950
  }
951
 
classes/Actions.php CHANGED
@@ -502,7 +502,7 @@ class Actions {
502
  . ' ' . wpforo_member_link(wpforo_member($post), '', 20, '', false)
503
  . '&nbsp;&bullet;&nbsp;'
504
  . ' ' . wpforo_date($post['created'], 'ago', false),
505
- 'content' => trim( $post['body'] ),
506
  ]
507
  );
508
  }
@@ -577,7 +577,7 @@ class Actions {
577
  $errors = retrieve_password();
578
  if( is_wp_error( $errors ) ) {
579
  $redirect_url = wpforo_lostpassword_url();
580
- WPF()->notice->add( implode( ',', $errors->get_error_codes() ), 'error' );
581
  } else {
582
  $redirect_url = wpforo_login_url();
583
  WPF()->notice->add( 'Email has been sent', 'success' );
@@ -2417,23 +2417,24 @@ class Actions {
2417
  wpforo_delete_option( 'wpforo_authorization' );
2418
  } else {
2419
  $authorization = wpforo_array_args_cast_and_merge( wp_unslash( $_POST['authorization'] ), WPF()->settings->_authorization );
2420
- if( preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['login_url'] ) ) $authorization['login_url'] = '';
2421
- if( preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['register_url'] ) ) $authorization['register_url'] = '';
2422
- if( preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['lost_password_url'] ) ) $authorization['lost_password_url'] = '';
2423
-
2424
- if( ! preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['redirect_url_after_login'] ) ) $authorization['redirect_url_after_login'] = '';
2425
- if( ! preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['redirect_url_after_register'] ) ) $authorization['redirect_url_after_register'] = '';
2426
- if( ! preg_match( '#^https?://[^\r\n\t\s\0]+#isu', $authorization['redirect_url_after_confirm_sbscrb'] ) ) $authorization['redirect_url_after_confirm_sbscrb'] = '';
2427
-
2428
- $authorization['login_url'] = esc_url_raw( $authorization['login_url'] );
2429
- $authorization['register_url'] = esc_url_raw( $authorization['register_url'] );
2430
- $authorization['lost_password_url'] = esc_url_raw( $authorization['lost_password_url'] );
2431
- $authorization['redirect_url_after_login'] = esc_url_raw( $authorization['redirect_url_after_login'] );
2432
- $authorization['redirect_url_after_register'] = esc_url_raw( $authorization['redirect_url_after_register'] );
2433
- $authorization['redirect_url_after_confirm_sbscrb'] = esc_url_raw( $authorization['redirect_url_after_confirm_sbscrb'] );
2434
- $authorization['fb_api_id'] = sanitize_text_field( $authorization['fb_api_id'] );
2435
- $authorization['fb_api_secret'] = sanitize_text_field( $authorization['fb_api_secret'] );
2436
- $authorization['fb_redirect_url'] = esc_url_raw( $authorization['fb_redirect_url'] );
 
2437
 
2438
  wpforo_update_option( 'wpforo_authorization', $authorization );
2439
  }
502
  . ' ' . wpforo_member_link(wpforo_member($post), '', 20, '', false)
503
  . '&nbsp;&bullet;&nbsp;'
504
  . ' ' . wpforo_date($post['created'], 'ago', false),
505
+ 'content' => trim( wpforo_content( $post, false ) ),
506
  ]
507
  );
508
  }
577
  $errors = retrieve_password();
578
  if( is_wp_error( $errors ) ) {
579
  $redirect_url = wpforo_lostpassword_url();
580
+ WPF()->notice->add( implode( ',', $errors->get_error_messages() ), 'error' );
581
  } else {
582
  $redirect_url = wpforo_login_url();
583
  WPF()->notice->add( 'Email has been sent', 'success' );
2417
  wpforo_delete_option( 'wpforo_authorization' );
2418
  } else {
2419
  $authorization = wpforo_array_args_cast_and_merge( wp_unslash( $_POST['authorization'] ), WPF()->settings->_authorization );
2420
+
2421
+ if( preg_match( '#^https?://\S+$#iu', $authorization['login_url'] ) ) $authorization['login_url'] = '';
2422
+ if( preg_match( '#^https?://\S+$#iu', $authorization['register_url'] ) ) $authorization['register_url'] = '';
2423
+ if( preg_match( '#^https?://\S+$#iu', $authorization['lost_password_url'] ) ) $authorization['lost_password_url'] = '';
2424
+
2425
+ if( ! preg_match( '#^https?://\S+$#iu', $authorization['redirect_url_after_login'] ) ) $authorization['redirect_url_after_login'] = '';
2426
+ if( ! preg_match( '#^https?://\S+$#iu', $authorization['redirect_url_after_register'] ) ) $authorization['redirect_url_after_register'] = '';
2427
+ if( ! preg_match( '#^https?://\S+$#iu', $authorization['redirect_url_after_confirm_sbscrb'] ) ) $authorization['redirect_url_after_confirm_sbscrb'] = '';
2428
+
2429
+ $authorization['login_url'] = esc_url_raw( $authorization['login_url'] );
2430
+ $authorization['register_url'] = esc_url_raw( $authorization['register_url'] );
2431
+ $authorization['lost_password_url'] = esc_url_raw( $authorization['lost_password_url'] );
2432
+ $authorization['redirect_url_after_login'] = esc_url_raw( $authorization['redirect_url_after_login'] );
2433
+ $authorization['redirect_url_after_register'] = esc_url_raw( $authorization['redirect_url_after_register'] );
2434
+ $authorization['redirect_url_after_confirm_sbscrb'] = esc_url_raw( $authorization['redirect_url_after_confirm_sbscrb'] );
2435
+ $authorization['fb_api_id'] = sanitize_text_field( $authorization['fb_api_id'] );
2436
+ $authorization['fb_api_secret'] = sanitize_text_field( $authorization['fb_api_secret'] );
2437
+ $authorization['fb_redirect_url'] = esc_url_raw( $authorization['fb_redirect_url'] );
2438
 
2439
  wpforo_update_option( 'wpforo_authorization', $authorization );
2440
  }
classes/Forums.php CHANGED
@@ -800,6 +800,7 @@ class Forums {
800
  foreach( $forumids as $forumid ) {
801
  $forumid = intval( $forumid );
802
  if( ! $forumid || ( ! wpforo_is_admin() && ! WPF()->perm->forum_can( 'vf', $forumid ) ) || ( wpforo_is_admin() && ! WPF()->usergroup->can_manage_forum() ) ) continue;
 
803
  $depth = 0;
804
  $this->count_depth( $forumid, $depth );
805
  $forum = wpforo_forum( $forumid );
800
  foreach( $forumids as $forumid ) {
801
  $forumid = intval( $forumid );
802
  if( ! $forumid || ( ! wpforo_is_admin() && ! WPF()->perm->forum_can( 'vf', $forumid ) ) || ( wpforo_is_admin() && ! WPF()->usergroup->can_manage_forum() ) ) continue;
803
+ if( $type === 'subscribe_manager_form' && ! WPF()->perm->forum_can( 'sb', $forumid ) ) continue;
804
  $depth = 0;
805
  $this->count_depth( $forumid, $depth );
806
  $forum = wpforo_forum( $forumid );
classes/Settings.php CHANGED
@@ -841,8 +841,8 @@ class Settings {
841
  "min" => 0,
842
  "label" => esc_html__( "Topic Content Minimum Length", "wpforo" ),
843
  "label_original" => "Topic Content Minimum Length",
844
- "description" => esc_html__( "", "wpforo" ),
845
- "description_original" => "",
846
  "docurl" => "",
847
  ],
848
  "topic_body_max_length" => [
@@ -856,11 +856,11 @@ class Settings {
856
  ],
857
  "post_body_min_length" => [
858
  "type" => "number",
859
- "min" => 0,
860
  "label" => esc_html__( "Reply Content Minimum Length", "wpforo" ),
861
  "label_original" => "Reply Content Minimum Length",
862
- "description" => esc_html__( "", "wpforo" ),
863
- "description_original" => "",
864
  "docurl" => "",
865
  ],
866
  "post_body_max_length" => [
841
  "min" => 0,
842
  "label" => esc_html__( "Topic Content Minimum Length", "wpforo" ),
843
  "label_original" => "Topic Content Minimum Length",
844
+ "description" => esc_html__( "Set this option value 0 to remove this limit.", "wpforo" ),
845
+ "description_original" => "Set this option value 0 to remove this limit.",
846
  "docurl" => "",
847
  ],
848
  "topic_body_max_length" => [
856
  ],
857
  "post_body_min_length" => [
858
  "type" => "number",
859
+ "min" => 1,
860
  "label" => esc_html__( "Reply Content Minimum Length", "wpforo" ),
861
  "label_original" => "Reply Content Minimum Length",
862
+ "description" => esc_html__( "You cannot set this value 0.", "wpforo" ),
863
+ "description_original" => "You cannot set this value 0.",
864
  "docurl" => "",
865
  ],
866
  "post_body_max_length" => [
classes/Template.php CHANGED
@@ -2772,7 +2772,7 @@ class Template {
2772
  $userid,
2773
  $postid,
2774
  $mention,
2775
- ( $posted_by ? sprintf('<div class="wpforo-post-quote-author"><strong> Posted by: %1$s </strong></div>', $posted_by) : '' ),
2776
  ( $postid ? sprintf( '<div class="wpforo-post-quote-link"><a href="%1$s" title="%2$s">&uarr;</a></div>', WPF()->post->get_url( $postid ), wpforo_phrase( 'go to original post', false ) ) : '' )
2777
  );
2778
  }, $text );
2772
  $userid,
2773
  $postid,
2774
  $mention,
2775
+ ( $posted_by ? sprintf('<div class="wpforo-post-quote-author"><strong> %1$s: %2$s </strong></div>', wpforo_phrase( 'Posted by', false ), $posted_by) : '' ),
2776
  ( $postid ? sprintf( '<div class="wpforo-post-quote-link"><a href="%1$s" title="%2$s">&uarr;</a></div>', WPF()->post->get_url( $postid ), wpforo_phrase( 'go to original post', false ) ) : '' )
2777
  );
2778
  }, $text );
classes/Topics.php CHANGED
@@ -44,11 +44,12 @@ class Topics {
44
 
45
  if( empty( $args ) && empty( $_REQUEST['thread'] ) ) return false;
46
  if( empty( $args ) && ! empty( $_REQUEST['thread'] ) ) $args = $_REQUEST['thread'];
47
- if( ! isset( $args['body'] ) || ! $args['body'] ) {
48
- WPF()->notice->add( 'Post is empty', 'error' );
49
-
50
- return false;
51
- }
 
52
  $args['name'] = ( isset( $args['name'] ) ? strip_tags( $args['name'] ) : '' );
53
  $args['email'] = ( isset( $args['email'] ) ? sanitize_email( $args['email'] ) : '' );
54
 
@@ -76,7 +77,7 @@ class Topics {
76
  return false;
77
  }
78
 
79
- if( ! isset( $args['title'] ) || ! $args['title'] = trim( strip_tags( $args['title'] ) ) ) {
80
  WPF()->notice->add( 'Please insert required fields!', 'error' );
81
 
82
  return false;
@@ -95,7 +96,6 @@ class Topics {
95
  do_action( 'wpforo_start_add_topic', $args, $forum );
96
 
97
  $root_exists = wpforo_root_exist();
98
- $args['title'] = wpforo_text( $args['title'], 250, false );
99
  $args['body'] = preg_replace( '#</pre>[\r\n\t\s\0]*<pre>#isu', "\r\n", $args['body'] );
100
  $args['slug'] = ( isset( $args['slug'] ) && $args['slug'] ) ? sanitize_title( $args['slug'] ) : ( ( isset( $args['title'] ) ) ? sanitize_title( $args['title'] ) : md5( time() ) );
101
  if( ! trim( $args['slug'] ) ) $args['slug'] = md5( time() );
@@ -221,7 +221,6 @@ class Topics {
221
  }
222
 
223
  public function edit( $args = [] ) {
224
-
225
  if( empty( $args ) && empty( $_REQUEST['thread'] ) ) return false;
226
  if( ! isset( $args['topicid'] ) && isset( $_GET['id'] ) ) $args['topicid'] = intval( $_GET['id'] );
227
  if( empty( $args ) && ! empty( $_REQUEST['thread'] ) ) $args = $_REQUEST['thread'];
@@ -265,6 +264,13 @@ class Topics {
265
  $args = apply_filters( 'wpforo_edit_topic_data_filter', $args, $forum );
266
  if( empty( $args ) ) return false;
267
 
 
 
 
 
 
 
 
268
  extract( $args, EXTR_OVERWRITE );
269
 
270
  if( isset( $topicid ) ) $topicid = intval( $topicid );
@@ -289,13 +295,12 @@ class Topics {
289
 
290
  return false;
291
  }
292
- if( ! isset( $title ) || ! $title = trim( strip_tags( $title ) ) ) {
293
  WPF()->notice->add( 'Please insert required fields!', 'error' );
294
 
295
  return false;
296
  }
297
 
298
- $title = wpforo_text( $title, 250, false );
299
  if( isset( $body ) ) $body = preg_replace( '#</pre>[\r\n\t\s\0]*<pre>#isu', "\r\n", $body );
300
 
301
  $diff = current_time( 'timestamp', 1 ) - strtotime( $topic['created'] );
@@ -347,7 +352,7 @@ class Topics {
347
  return false;
348
  }
349
 
350
- $body = ( ( isset( $body ) && $body ) ? stripslashes( $body ) : stripslashes( $post['body'] ) );
351
 
352
  $p_update = WPF()->db->update( WPF()->tables->posts,
353
  [
@@ -545,8 +550,6 @@ class Topics {
545
  * array get_topic(array or id(num))
546
  * Returns merged arguments array from defined and default arguments.
547
  *
548
- * @param array defined arguments array for returning
549
- *
550
  * @return array where count is topic count and other numeric arrays with topic
551
  * @since 1.0.0
552
  *
44
 
45
  if( empty( $args ) && empty( $_REQUEST['thread'] ) ) return false;
46
  if( empty( $args ) && ! empty( $_REQUEST['thread'] ) ) $args = $_REQUEST['thread'];
47
+ if( $min = wpforo_setting('posting', 'topic_body_min_length') ){
48
+ if( wpfkey( $args, 'body' ) && (int) $min > wpforo_length( $args['body'] ) ) {
49
+ WPF()->notice->add( 'The content is too short', 'error' );
50
+ return false;
51
+ }
52
+ }
53
  $args['name'] = ( isset( $args['name'] ) ? strip_tags( $args['name'] ) : '' );
54
  $args['email'] = ( isset( $args['email'] ) ? sanitize_email( $args['email'] ) : '' );
55
 
77
  return false;
78
  }
79
 
80
+ if( ! isset( $args['title'] ) || ! $args['title'] = wpforo_text( $args['title'], 250, false, true, false, false, false ) ) {
81
  WPF()->notice->add( 'Please insert required fields!', 'error' );
82
 
83
  return false;
96
  do_action( 'wpforo_start_add_topic', $args, $forum );
97
 
98
  $root_exists = wpforo_root_exist();
 
99
  $args['body'] = preg_replace( '#</pre>[\r\n\t\s\0]*<pre>#isu', "\r\n", $args['body'] );
100
  $args['slug'] = ( isset( $args['slug'] ) && $args['slug'] ) ? sanitize_title( $args['slug'] ) : ( ( isset( $args['title'] ) ) ? sanitize_title( $args['title'] ) : md5( time() ) );
101
  if( ! trim( $args['slug'] ) ) $args['slug'] = md5( time() );
221
  }
222
 
223
  public function edit( $args = [] ) {
 
224
  if( empty( $args ) && empty( $_REQUEST['thread'] ) ) return false;
225
  if( ! isset( $args['topicid'] ) && isset( $_GET['id'] ) ) $args['topicid'] = intval( $_GET['id'] );
226
  if( empty( $args ) && ! empty( $_REQUEST['thread'] ) ) $args = $_REQUEST['thread'];
264
  $args = apply_filters( 'wpforo_edit_topic_data_filter', $args, $forum );
265
  if( empty( $args ) ) return false;
266
 
267
+ if( $min = wpforo_setting('posting', 'topic_body_min_length') ){
268
+ if( wpfkey( $args, 'body' ) && (int) $min > wpforo_length( $args['body'] ) ) {
269
+ WPF()->notice->add( 'The content is too short', 'error' );
270
+ return false;
271
+ }
272
+ }
273
+
274
  extract( $args, EXTR_OVERWRITE );
275
 
276
  if( isset( $topicid ) ) $topicid = intval( $topicid );
295
 
296
  return false;
297
  }
298
+ if( ! isset( $title ) || ! $title = wpforo_text( $title, 250, false, true, false, false, false ) ) {
299
  WPF()->notice->add( 'Please insert required fields!', 'error' );
300
 
301
  return false;
302
  }
303
 
 
304
  if( isset( $body ) ) $body = preg_replace( '#</pre>[\r\n\t\s\0]*<pre>#isu', "\r\n", $body );
305
 
306
  $diff = current_time( 'timestamp', 1 ) - strtotime( $topic['created'] );
352
  return false;
353
  }
354
 
355
+ $body = ( !$min || ( isset( $body ) && $body ) ) ? stripslashes( $body ) : stripslashes( $post['body'] );
356
 
357
  $p_update = WPF()->db->update( WPF()->tables->posts,
358
  [
550
  * array get_topic(array or id(num))
551
  * Returns merged arguments array from defined and default arguments.
552
  *
 
 
553
  * @return array where count is topic count and other numeric arrays with topic
554
  * @since 1.0.0
555
  *
includes/functions-template.php CHANGED
@@ -103,10 +103,11 @@ function wpforo_post_edited( $post, $echo = true ) {
103
  }
104
 
105
  function wpforo_hide_title( $title, $id = 0 ) {
106
- if( ! wpforo_setting( 'components', 'page_title' )
 
107
  && is_wpforo_page()
108
  && $id === WPF()->board->get_current( 'pageid' )
109
- && in_the_loop() && is_page( $id )
110
  ) $title = '';
111
 
112
  return $title;
@@ -259,13 +260,44 @@ function wpforo_get_postmeta( $postid, $metakeys = '', $single = false ){
259
  ########################## THEME API FUNCTIONS ################################
260
  ###############################################################################
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  function wpforo_post( $postid, $var = 'item', $echo = false ) {
263
- $post = ( $var === 'item' ) ? [] : '';
264
  if( ! $postid ) return $post;
265
  $cache = WPF()->cache->on();
266
- if( $cache ) {
267
- $post = WPF()->cache->get_item( $postid, 'post' );
268
- }
269
  if( empty( $post ) ) {
270
  $post = [];
271
  if( ! $cache && $var === 'url' ) {
@@ -297,16 +329,43 @@ function wpforo_post( $postid, $var = 'item', $echo = false ) {
297
  }
298
  }
299
 
300
- if( $var !== 'item' && $var ) {
301
- $post = wpfkey( $post, $var ) ? $post[ $var ] : wpforo_get_postmeta( $postid, $var, true );
302
- }
303
 
304
  if( $echo && is_scalar( $post ) ) echo $post;
305
  return $post;
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  function wpforo_topic( $topicid, $var = 'item', $echo = false ) {
309
- $topic = ( $var === 'item' ) ? [] : '';
310
  if( ! $topicid ) return $topic;
311
  $cache = WPF()->cache->on();
312
  if( $cache ) $topic = WPF()->cache->get_item( $topicid, 'topic' );
@@ -333,23 +392,38 @@ function wpforo_topic( $topicid, $var = 'item', $echo = false ) {
333
  }
334
  }
335
 
336
- if( $var !== 'item' && $var ) {
337
  if( $var === 'body' ){
338
  $topic = wpforo_post( $topic['first_postid'], 'body' );
339
  }else{
340
- $topic = wpfkey( $topic, $var ) ? $topic[ $var ] : '';
341
  }
342
  }
343
 
344
- if( $echo ) {
345
- echo $topic;
346
- } else {
347
- return $topic;
 
 
 
 
 
 
 
 
 
 
 
348
  }
 
 
 
 
349
  }
350
 
351
  function wpforo_forum( $forumid, $var = 'item', $echo = false ) {
352
- $forum = ( $var === 'item' ) ? [] : '';
353
  $cache = WPF()->cache->on();
354
  if( ! $forumid ) return $forum;
355
  if( $cache ) $forum = WPF()->cache->get_item( $forumid, 'forum' );
@@ -376,15 +450,10 @@ function wpforo_forum( $forumid, $var = 'item', $echo = false ) {
376
  }
377
  }
378
 
379
- if( $var != 'item' && $var ) {
380
- $forum = ( isset( $forum[ $var ] ) ) ? $forum[ $var ] : '';
381
- }
382
 
383
- if( $echo ) {
384
- echo $forum;
385
- } else {
386
- return $forum;
387
- }
388
  }
389
 
390
  function wpforo_member( $object, $var = 'item', $echo = false ) {
@@ -413,8 +482,24 @@ function wpforo_current_usermeta( $key ) {
413
  }
414
  }
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  function wpforo_tag( $tagid, $var = 'item', $echo = false ) {
417
- $tag = ( $var == 'item' ) ? [] : '';
418
  if( ! $tagid ) return $tag;
419
  $cache = WPF()->cache->on();
420
 
@@ -436,15 +521,10 @@ function wpforo_tag( $tagid, $var = 'item', $echo = false ) {
436
  }
437
  }
438
 
439
- if( $var != 'item' && $var ) {
440
- $tag = ( isset( $tag[ $var ] ) ) ? $tag[ $var ] : '';
441
- }
442
 
443
- if( $echo ) {
444
- echo $tag;
445
- } else {
446
- return $tag;
447
- }
448
  }
449
 
450
  function wpforo_member_link( $member, $prefix = '', $length = 30, $class = '', $echo = true ) {
103
  }
104
 
105
  function wpforo_hide_title( $title, $id = 0 ) {
106
+ if( is_page( $id )
107
+ && in_the_loop()
108
  && is_wpforo_page()
109
  && $id === WPF()->board->get_current( 'pageid' )
110
+ && ! wpforo_setting( 'components', 'page_title' )
111
  ) $title = '';
112
 
113
  return $title;
260
  ########################## THEME API FUNCTIONS ################################
261
  ###############################################################################
262
 
263
+ function _wpforo_post( $postid, $var = 'item' ) {
264
+ $post = ( $var === 'item' ) ? [] : null;
265
+ if( ! $postid ) return $post;
266
+
267
+ if( $var === 'url' ) {
268
+ $post['url'] = WPF()->post->get_url( $postid );
269
+ } elseif( $var === 'full_url' ) {
270
+ $post['full_url'] = WPF()->post->get_full_url( $postid );
271
+ } elseif( $var === 'short_url' ) {
272
+ $post['short_url'] = WPF()->post->get_short_url( $postid );
273
+ } elseif( $var === 'is_answered' ) {
274
+ $post['is_answered'] = WPF()->post->is_answered( $postid );
275
+ } elseif( $var === 'likes_count' ) {
276
+ $post['likes_count'] = WPF()->reaction->get_post_reactions_count( $postid );
277
+ } elseif( $var === 'likers_usernames' ) {
278
+ $post['likers_usernames'] = WPF()->reaction->get_post_reactions_user_dnames( $postid );
279
+ } else {
280
+ $post = WPF()->post->_get_post( $postid, false );
281
+ if( ! empty( $post ) ) {
282
+ $post['url'] = WPF()->post->get_url( $post );
283
+ $post['full_url'] = WPF()->post->get_full_url( $post );
284
+ $post['short_url'] = WPF()->post->get_short_url( $post );
285
+ $post['is_answered'] = WPF()->post->is_answered( $postid );
286
+ $post['likes_count'] = WPF()->reaction->get_post_reactions_count( $postid );
287
+ $post['likers_usernames'] = WPF()->reaction->get_post_reactions_user_dnames( $postid );
288
+ }
289
+ }
290
+
291
+ if( $var !== 'item' ) $post = wpfkey( $post, $var ) ? $post[ $var ] : wpforo_get_postmeta( $postid, $var, true );
292
+
293
+ return $post;
294
+ }
295
+
296
  function wpforo_post( $postid, $var = 'item', $echo = false ) {
297
+ $post = ( $var === 'item' ) ? [] : null;
298
  if( ! $postid ) return $post;
299
  $cache = WPF()->cache->on();
300
+ if( $cache ) $post = WPF()->cache->get_item( $postid, 'post' );
 
 
301
  if( empty( $post ) ) {
302
  $post = [];
303
  if( ! $cache && $var === 'url' ) {
329
  }
330
  }
331
 
332
+ if( $var !== 'item' ) $post = wpfkey( $post, $var ) ? $post[ $var ] : wpforo_get_postmeta( $postid, $var, true );
 
 
333
 
334
  if( $echo && is_scalar( $post ) ) echo $post;
335
  return $post;
336
  }
337
 
338
+ function _wpforo_topic( $topicid, $var = 'item' ) {
339
+ $topic = ( $var === 'item' ) ? [] : null;
340
+ if( ! $topicid ) return $topic;
341
+ if( $var === 'url' ) {
342
+ $topic['url'] = WPF()->topic->_get_url( $topicid );
343
+ }elseif( $var === 'full_url' ) {
344
+ $topic['full_url'] = WPF()->topic->get_full_url( $topicid );
345
+ }elseif( $var === 'short_url' ) {
346
+ $topic['short_url'] = WPF()->topic->get_short_url( $topicid );
347
+ } else {
348
+ $topic = WPF()->topic->_get_topic( $topicid, false );
349
+ if( ! empty( $topic ) ) {
350
+ $topic['url'] = WPF()->topic->_get_url( $topic );
351
+ $topic['full_url'] = WPF()->topic->get_full_url( $topic );
352
+ $topic['short_url'] = WPF()->topic->get_short_url( $topic );
353
+ }
354
+ }
355
+
356
+ if( $var !== 'item' ) {
357
+ if( $var === 'body' ){
358
+ $topic = wpforo_bigintval( wpfval( $topic, 'first_postid' ) ) ? _wpforo_post( $topic['first_postid'], 'body' ) : '';
359
+ }else{
360
+ $topic = wpfval( $topic, $var );
361
+ }
362
+ }
363
+
364
+ return $topic;
365
+ }
366
+
367
  function wpforo_topic( $topicid, $var = 'item', $echo = false ) {
368
+ $topic = ( $var === 'item' ) ? [] : null;
369
  if( ! $topicid ) return $topic;
370
  $cache = WPF()->cache->on();
371
  if( $cache ) $topic = WPF()->cache->get_item( $topicid, 'topic' );
392
  }
393
  }
394
 
395
+ if( $var !== 'item' ) {
396
  if( $var === 'body' ){
397
  $topic = wpforo_post( $topic['first_postid'], 'body' );
398
  }else{
399
+ $topic = wpfval( $topic, $var );
400
  }
401
  }
402
 
403
+ if( $echo && is_scalar( $topic ) ) echo $topic;
404
+ return $topic;
405
+ }
406
+
407
+ function _wpforo_forum( $forumid, $var = 'item' ) {
408
+ $forum = ( $var === 'item' ) ? [] : null;
409
+ if( ! $forumid ) return $forum;
410
+
411
+ $forum = WPF()->forum->_get_forum( $forumid );
412
+ if( ! empty( $forum ) ) {
413
+ if( in_array( $var, [ 'childs', 'counts' ], true ) ) {
414
+ $forum['childs'] = WPF()->forum->get_childs( $forumid );
415
+ $forum['childs'][] = $forumid;
416
+ if( $var === 'counts' ) $forum['counts'] = WPF()->forum->get_counts( $forum['childs'] );
417
+ }
418
  }
419
+
420
+ if( $var !== 'item' ) $forum = wpfval( $forum, $var );
421
+
422
+ return $forum;
423
  }
424
 
425
  function wpforo_forum( $forumid, $var = 'item', $echo = false ) {
426
+ $forum = ( $var === 'item' ) ? [] : null;
427
  $cache = WPF()->cache->on();
428
  if( ! $forumid ) return $forum;
429
  if( $cache ) $forum = WPF()->cache->get_item( $forumid, 'forum' );
450
  }
451
  }
452
 
453
+ if( $var !== 'item' ) $forum = wpfval( $forum, $var );
 
 
454
 
455
+ if( $echo && is_scalar( $forum ) ) echo $forum;
456
+ return $forum;
 
 
 
457
  }
458
 
459
  function wpforo_member( $object, $var = 'item', $echo = false ) {
482
  }
483
  }
484
 
485
+ function _wpforo_tag( $tagid, $var = 'item' ) {
486
+ $tag = ( $var == 'item' ) ? [] : null;
487
+ if( ! $tagid ) return $tag;
488
+
489
+ if( $var === 'url' && wpfval( $tag, 'tag' ) ) {
490
+ $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
491
+ } else {
492
+ $tag = WPF()->topic->get_tag( $tagid );
493
+ if( ! empty( $tag ) ) $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
494
+ }
495
+
496
+ if( $var !== 'item' ) $tag = wpfval( $tag, $var );
497
+
498
+ return $tag;
499
+ }
500
+
501
  function wpforo_tag( $tagid, $var = 'item', $echo = false ) {
502
+ $tag = ( $var == 'item' ) ? [] : null;
503
  if( ! $tagid ) return $tag;
504
  $cache = WPF()->cache->on();
505
 
521
  }
522
  }
523
 
524
+ if( $var !== 'item' ) $tag = wpfval( $tag, $var );
 
 
525
 
526
+ if( $echo && is_scalar( $tag ) ) echo $tag;
527
+ return $tag;
 
 
 
528
  }
529
 
530
  function wpforo_member_link( $member, $prefix = '', $length = 30, $class = '', $echo = true ) {
includes/functions.php CHANGED
@@ -470,7 +470,7 @@ function wpforo_is_admin( $url = '' ) {
470
 
471
  function _is_wpforo_page( $url = '' ) {
472
  if( ! $url ) $url = wpforo_get_request_uri();
473
- $result = ( ! ( wpforo_is_admin( $url ) || ( is_wpforo_exclude_url( $url ) && ! is_wpforo_shortcode_page( $url ) ) ) && ( is_wpforo_url( $url ) || is_wpforo_shortcode_page( $url ) ) );
474
 
475
  return apply_filters( 'is_wpforo_page', $result, $url );
476
  }
@@ -485,7 +485,7 @@ function _is_wpforo_exclude_url( $url = '' ) {
485
  $url = urldecode( $url );
486
  $url = preg_replace( '#/page/\d*/?$#isu', '', $url );
487
  if( $current_url = wpforo_get_url_query_vars_str( $url ) ) {
488
- if( preg_match( '#^/?(?:([^\s/\?\&=<>:\'\"\*\:\\\|]*/)(?1)*)?[^\s/\?\&=<>:\'\"\*\:\\\|]+\.(?:php|js|css|jpe?g|png|gif|webp|svg|bmp|tiff)/?(?:\?[^/]*)?$#iu', $current_url ) ) {
489
  $result = true;
490
  } elseif( WPF()->board->get_current( 'is_standalone' ) && ( $excld_urls = WPF()->board->get_current( 'excld_urls' ) ) ) {
491
  foreach( $excld_urls as $excld_url ) {
@@ -722,7 +722,7 @@ function wpforo_arr_group_by( $array, $key_by ) {
722
  function wpforo_phrase( $key, $echo = true, $format = 'first-upper' ) {
723
  $locale = WPF()->locale;
724
  $phrase = ( isset( WPF()->phrase->phrases[ addslashes( strtolower( $key ) ) ] ) ) ? WPF()->phrase->phrases[ addslashes( strtolower( $key ) ) ] : $key;
725
- if( 'en_US' != $locale ) {
726
  $native = $phrase;
727
  $backtrace = wp_debug_backtrace_summary();
728
  $mopo_domain = 'wpforo';
@@ -730,14 +730,14 @@ function wpforo_phrase( $key, $echo = true, $format = 'first-upper' ) {
730
  if( strpos( $backtrace, 'wpForoPolls' ) !== false ) $mopo_domain = 'wpforo_poll';
731
  $key = preg_replace( "/(^\s+)|(\s+$)/u", "", $key );
732
  $phrase = preg_replace( "/(^\s+)|(\s+$)/u", "", $phrase );
733
- if( strtolower( $key ) == strtolower( $phrase ) ) {
734
  $phrase = __( $key, $mopo_domain );
735
- if( strtolower( $key ) == strtolower( $phrase ) ) {
736
  $key = strtolower( $key );
737
  $phrase = __( $key, $mopo_domain );
738
- if( strtolower( $key ) == strtolower( $phrase ) ) {
739
  $phrase = __( ucfirst( $key ), $mopo_domain );
740
- if( strtolower( $key ) == strtolower( $phrase ) ) {
741
  $phrase = __( $native, $mopo_domain ); //Try all, if no result pass the original text to translation again.
742
  }
743
  }
@@ -745,19 +745,19 @@ function wpforo_phrase( $key, $echo = true, $format = 'first-upper' ) {
745
  }
746
  }
747
 
748
- if( $format == 'first-upper' ) {
749
- if( 'en_US' != $locale && function_exists( 'mb_strlen' ) && mb_strlen( $phrase ) != strlen( $phrase ) && function_exists( 'mb_strtoupper' ) ) {
750
  $phrase = mb_strtoupper( mb_substr( $phrase, 0, 1 ) ) . mb_substr( $phrase, 1 );
751
  } else {
752
  $phrase = ucfirst( $phrase );
753
  }
754
- } elseif( $format == 'upper' ) {
755
  if( function_exists( 'mb_strtoupper' ) ) {
756
  $phrase = mb_strtoupper( $phrase );
757
  } else {
758
  $phrase = strtoupper( $phrase );
759
  }
760
- } elseif( $format == 'lower' ) {
761
  if( function_exists( 'mb_strtolower' ) ) {
762
  $phrase = mb_strtolower( $phrase );
763
  } else {
@@ -767,15 +767,11 @@ function wpforo_phrase( $key, $echo = true, $format = 'first-upper' ) {
767
 
768
  $phrase = str_replace( '{number}', '', $phrase );
769
 
770
- if( $echo ) {
771
- echo $phrase;
772
- } else {
773
- return $phrase;
774
- }
775
  }
776
 
777
  function wpforo_screen_option() { ?>
778
-
779
  <div id="screen-meta" class="metabox-prefs" style="display: none; ">
780
  <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="Screen Options Tab" style="display: none; ">
781
  <form id="adv-settings" action="" method="POST">
@@ -828,9 +824,9 @@ function wpforo_text( $text, $length = 0, $echo = true, $strip_tags = true, $str
828
  $text = str_replace( '</p>', '</p> ', $text );
829
  $text = str_replace( '</div>', '</div> ', $text );
830
 
831
- if( $strip_quotes ) $text = wpforo_strip_quotes( $text );
832
- if( $strip_urls ) $text = wpforo_strip_urls( $text );
833
- if( $strip_tags ) $text = strip_tags( $text );
834
  if( $strip_shortcodes ) $text = wpforo_strip_shortcodes( $text );
835
 
836
  $text = apply_filters( 'wpforo_text', $text, $length, $echo, $strip_tags, $strip_urls, $strip_shortcodes, $strip_quotes );
@@ -838,27 +834,15 @@ function wpforo_text( $text, $length = 0, $echo = true, $strip_tags = true, $str
838
  $text = trim( str_replace( "\xc2\xa0", ' ', $text ) );
839
 
840
  if( ! $length ) {
841
- if( $echo ) {
842
- echo trim( $text );
843
-
844
- return '';
845
- } else {
846
- return trim( $text );
847
- }
848
- }
849
- if( function_exists( 'mb_substr' ) ) {
850
- if( $echo ) {
851
- echo trim( mb_substr( $text, 0, $length, get_option( 'blog_charset' ) ) . ( ( function_exists( 'mb_strlen' ) ? mb_strlen( $text, get_option( 'blog_charset' ) ) : strlen( $text ) ) > $length ? '...' : '' ) );
852
- } else {
853
- return trim( mb_substr( $text, 0, $length, get_option( 'blog_charset' ) ) . ( ( function_exists( 'mb_strlen' ) ? mb_strlen( $text, get_option( 'blog_charset' ) ) : strlen( $text ) ) > $length ? '...' : '' ) );
854
- }
855
  } else {
856
- if( $echo ) {
857
- echo trim( substr( $text, 0, $length ) . ( strlen( $text ) > $length ? '...' : '' ) );
858
- } else {
859
- return trim( substr( $text, 0, $length ) . ( strlen( $text ) > $length ? '...' : '' ) );
860
- }
861
  }
 
 
 
862
  }
863
 
864
  function wpforo_admin_options_tabs( $tabs, $current = 'general', $subtab = false, $sub_current = 'general' ) {
@@ -2908,7 +2892,7 @@ function wpforo_is_slug_base( $slug ) {
2908
  * @return mixed|null
2909
  */
2910
  function wpforo_setting( $group, $name ) {
2911
- if( property_exists( WPF()->settings, $group ) ) {
2912
  $args = func_get_args();
2913
  $args[0] = &WPF()->settings->$group;
2914
 
@@ -3003,6 +2987,7 @@ function wpforo_apply_email_shortcodes( $txt, $pitem, $item, $owner, $user, $uns
3003
 
3004
  function wpforo_send_email( $email, $sbj, $msg, $headers = '' ){
3005
  if( defined( 'IS_GO2WPFORO' ) && IS_GO2WPFORO ) return false;
 
3006
  $key = func_get_args();
3007
  if( WPF()->ram_cache->exists( $key ) ) return false;
3008
  add_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type', 999 );
@@ -3034,3 +3019,13 @@ function wpforo_sanitize( $action, $variable_name, $filter, $default = '' ) {
3034
 
3035
  return $variable ?: $default;
3036
  }
 
 
 
 
 
 
 
 
 
 
470
 
471
  function _is_wpforo_page( $url = '' ) {
472
  if( ! $url ) $url = wpforo_get_request_uri();
473
+ $result = ( ! ( wpforo_is_admin( $url ) || ( is_wpforo_exclude_url( $url ) && !is_wpforo_url( $url ) && ! is_wpforo_shortcode_page( $url ) ) ) && ( is_wpforo_url( $url ) || is_wpforo_shortcode_page( $url ) ) );
474
 
475
  return apply_filters( 'is_wpforo_page', $result, $url );
476
  }
485
  $url = urldecode( $url );
486
  $url = preg_replace( '#/page/\d*/?$#isu', '', $url );
487
  if( $current_url = wpforo_get_url_query_vars_str( $url ) ) {
488
+ if( preg_match( '#^/?(?:([^\s/?&=<>:\'\"*\\\|]*/)(?1)*)?[^\s/?&=<>:\'\"*\\\|]+\.(?:php|js|css|jpe?g|png|gif|webp|svg|bmp|tiff)/?(?:\?[^/]*)?$#iu', $current_url ) ) {
489
  $result = true;
490
  } elseif( WPF()->board->get_current( 'is_standalone' ) && ( $excld_urls = WPF()->board->get_current( 'excld_urls' ) ) ) {
491
  foreach( $excld_urls as $excld_url ) {
722
  function wpforo_phrase( $key, $echo = true, $format = 'first-upper' ) {
723
  $locale = WPF()->locale;
724
  $phrase = ( isset( WPF()->phrase->phrases[ addslashes( strtolower( $key ) ) ] ) ) ? WPF()->phrase->phrases[ addslashes( strtolower( $key ) ) ] : $key;
725
+ if( 'en_US' !== $locale ) {
726
  $native = $phrase;
727
  $backtrace = wp_debug_backtrace_summary();
728
  $mopo_domain = 'wpforo';
730
  if( strpos( $backtrace, 'wpForoPolls' ) !== false ) $mopo_domain = 'wpforo_poll';
731
  $key = preg_replace( "/(^\s+)|(\s+$)/u", "", $key );
732
  $phrase = preg_replace( "/(^\s+)|(\s+$)/u", "", $phrase );
733
+ if( strtolower( $key ) === strtolower( $phrase ) ) {
734
  $phrase = __( $key, $mopo_domain );
735
+ if( strtolower( $key ) === strtolower( $phrase ) ) {
736
  $key = strtolower( $key );
737
  $phrase = __( $key, $mopo_domain );
738
+ if( strtolower( $key ) === strtolower( $phrase ) ) {
739
  $phrase = __( ucfirst( $key ), $mopo_domain );
740
+ if( strtolower( $key ) === strtolower( $phrase ) ) {
741
  $phrase = __( $native, $mopo_domain ); //Try all, if no result pass the original text to translation again.
742
  }
743
  }
745
  }
746
  }
747
 
748
+ if( $format === 'first-upper' ) {
749
+ if( 'en_US' !== $locale && function_exists( 'mb_strlen' ) && mb_strlen( $phrase ) !== strlen( $phrase ) && function_exists( 'mb_strtoupper' ) ) {
750
  $phrase = mb_strtoupper( mb_substr( $phrase, 0, 1 ) ) . mb_substr( $phrase, 1 );
751
  } else {
752
  $phrase = ucfirst( $phrase );
753
  }
754
+ } elseif( $format === 'upper' ) {
755
  if( function_exists( 'mb_strtoupper' ) ) {
756
  $phrase = mb_strtoupper( $phrase );
757
  } else {
758
  $phrase = strtoupper( $phrase );
759
  }
760
+ } elseif( $format === 'lower' ) {
761
  if( function_exists( 'mb_strtolower' ) ) {
762
  $phrase = mb_strtolower( $phrase );
763
  } else {
767
 
768
  $phrase = str_replace( '{number}', '', $phrase );
769
 
770
+ if( $echo ) echo $phrase;
771
+ return $phrase;
 
 
 
772
  }
773
 
774
  function wpforo_screen_option() { ?>
 
775
  <div id="screen-meta" class="metabox-prefs" style="display: none; ">
776
  <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="Screen Options Tab" style="display: none; ">
777
  <form id="adv-settings" action="" method="POST">
824
  $text = str_replace( '</p>', '</p> ', $text );
825
  $text = str_replace( '</div>', '</div> ', $text );
826
 
827
+ if( $strip_quotes ) $text = wpforo_strip_quotes( $text );
828
+ if( $strip_urls ) $text = wpforo_strip_urls( $text );
829
+ if( $strip_tags ) $text = strip_tags( $text );
830
  if( $strip_shortcodes ) $text = wpforo_strip_shortcodes( $text );
831
 
832
  $text = apply_filters( 'wpforo_text', $text, $length, $echo, $strip_tags, $strip_urls, $strip_shortcodes, $strip_quotes );
834
  $text = trim( str_replace( "\xc2\xa0", ' ', $text ) );
835
 
836
  if( ! $length ) {
837
+ $text = trim( $text );
838
+ }elseif( function_exists( 'mb_substr' ) ) {
839
+ $text = trim( mb_substr( $text, 0, $length, get_option( 'blog_charset' ) ) . ( ( function_exists( 'mb_strlen' ) ? mb_strlen( $text, get_option( 'blog_charset' ) ) : strlen( $text ) ) > $length ? '...' : '' ) );
 
 
 
 
 
 
 
 
 
 
 
840
  } else {
841
+ $text = trim( substr( $text, 0, $length ) . ( strlen( $text ) > $length ? '...' : '' ) );
 
 
 
 
842
  }
843
+
844
+ if( $echo ) echo $text;
845
+ return $text;
846
  }
847
 
848
  function wpforo_admin_options_tabs( $tabs, $current = 'general', $subtab = false, $sub_current = 'general' ) {
2892
  * @return mixed|null
2893
  */
2894
  function wpforo_setting( $group, $name ) {
2895
+ if( ! is_null( WPF()->settings ) && property_exists( WPF()->settings, $group ) ) {
2896
  $args = func_get_args();
2897
  $args[0] = &WPF()->settings->$group;
2898
 
2987
 
2988
  function wpforo_send_email( $email, $sbj, $msg, $headers = '' ){
2989
  if( defined( 'IS_GO2WPFORO' ) && IS_GO2WPFORO ) return false;
2990
+ if( apply_filters( 'break_wpforo_send_email', false, $email, $sbj, $msg, $headers ) ) return false;
2991
  $key = func_get_args();
2992
  if( WPF()->ram_cache->exists( $key ) ) return false;
2993
  add_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type', 999 );
3019
 
3020
  return $variable ?: $default;
3021
  }
3022
+
3023
+ function wpforo_length( $str, $filtered = true ){
3024
+ $str = ( $filtered ) ? strip_shortcodes( strip_tags( trim( $str ) ) ) : $str;
3025
+ if( function_exists( 'mb_substr' ) ) {
3026
+ $length = mb_strlen( $str, get_option( 'blog_charset' ) );
3027
+ } else {
3028
+ $length = strlen( $str );
3029
+ }
3030
+ return (int) $length;
3031
+ }
includes/hooks.php CHANGED
@@ -211,7 +211,6 @@ function wpftpl( $filename ) {
211
 
212
  add_shortcode( 'wpforo', function ( $atts ) {
213
  if( defined( 'REST_REQUEST' ) && REST_REQUEST ) return '';
214
-
215
  if( ! is_wpforo_url() ) {
216
  if( ! $atts ) $atts = [ 'item' => 'forum' ];
217
  WPF()->init_current_url( $atts );
@@ -1928,6 +1927,7 @@ function wpforo_user_field_shortcode_to_value( $shortcode, $userid = null ) {
1928
 
1929
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:user_|owner_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1930
  if( ! $userid ) $userid = WPF()->current_userid;
 
1931
  $value = wpforo_member( $userid, $field );
1932
  }
1933
 
@@ -1940,10 +1940,10 @@ function wpforo_forum_field_shortcode_to_value( $shortcode, $forumid ) {
1940
  if( $forumid ){
1941
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:forum_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1942
  if( $field === 'link' ){
1943
- $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( wpforo_forum( $forumid, 'url' ) ), sanitize_text_field( wpforo_forum( $forumid, 'title' ) ) );
1944
  $value = stripslashes( $value );
1945
  }else{
1946
- $value = wpforo_forum( $forumid, $field );
1947
  }
1948
  }
1949
  }
@@ -1957,10 +1957,10 @@ function wpforo_topic_field_shortcode_to_value( $shortcode, $topicid ) {
1957
  if( $topicid ){
1958
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:topic_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1959
  if( $field === 'link' ){
1960
- $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( wpforo_topic( $topicid, 'url' ) ), sanitize_text_field( wpforo_topic( $topicid, 'title' ) ) );
1961
  $value = stripslashes( $value );
1962
  }else{
1963
- $value = wpforo_topic( $topicid, $field );
1964
  }
1965
  }
1966
  }
@@ -1974,10 +1974,10 @@ function wpforo_post_field_shortcode_to_value( $shortcode, $postid ) {
1974
  if($postid ){
1975
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:post_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1976
  if( $field === 'link' ){
1977
- $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( wpforo_post( $postid, 'url' ) ), sanitize_text_field( wpforo_post( $postid, 'title' ) ) );
1978
  $value = stripslashes( $value );
1979
  }else{
1980
- $value = wpforo_post( $postid, $field );
1981
  }
1982
  }
1983
  }
211
 
212
  add_shortcode( 'wpforo', function ( $atts ) {
213
  if( defined( 'REST_REQUEST' ) && REST_REQUEST ) return '';
 
214
  if( ! is_wpforo_url() ) {
215
  if( ! $atts ) $atts = [ 'item' => 'forum' ];
216
  WPF()->init_current_url( $atts );
1927
 
1928
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:user_|owner_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1929
  if( ! $userid ) $userid = WPF()->current_userid;
1930
+ if( in_array( $field, ['login','pass','nicename','email','url','registered','activation_key','status'], true ) ) $field = 'user_' . $field;
1931
  $value = wpforo_member( $userid, $field );
1932
  }
1933
 
1940
  if( $forumid ){
1941
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:forum_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1942
  if( $field === 'link' ){
1943
+ $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( _wpforo_forum( $forumid, 'url' ) ), sanitize_text_field( _wpforo_forum( $forumid, 'title' ) ) );
1944
  $value = stripslashes( $value );
1945
  }else{
1946
+ $value = _wpforo_forum( $forumid, $field );
1947
  }
1948
  }
1949
  }
1957
  if( $topicid ){
1958
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:topic_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1959
  if( $field === 'link' ){
1960
+ $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( _wpforo_topic( $topicid, 'url' ) ), sanitize_text_field( _wpforo_topic( $topicid, 'title' ) ) );
1961
  $value = stripslashes( $value );
1962
  }else{
1963
+ $value = _wpforo_topic( $topicid, $field );
1964
  }
1965
  }
1966
  }
1974
  if($postid ){
1975
  if( $shortcode && ($field = preg_replace( '#^\s*\[?\s*(?:post_)?(?:fields_)?([^\[\]]+?)\s*]?\s*$#iu', '$1', $shortcode )) ) {
1976
  if( $field === 'link' ){
1977
+ $value = sprintf( '<a target="_blank" href="%1$s">%2$s</a>', esc_url( _wpforo_post( $postid, 'url' ) ), sanitize_text_field( _wpforo_post( $postid, 'title' ) ) );
1978
  $value = stripslashes( $value );
1979
  }else{
1980
+ $value = _wpforo_post( $postid, $field );
1981
  }
1982
  }
1983
  }
modules/follows/classes/Actions.php CHANGED
@@ -50,9 +50,12 @@ class Actions {
50
  continue;
51
  }
52
 
 
 
53
  $key = 'topicid_' . $topic['topicid'] . '_user_email_' . $user['user_email'];
54
  if( ! WPF()->ram_cache->exists( $key ) ){
55
 
 
56
  if( wpforo_is_users_same( $owner, $user ) ) continue;
57
  if( wpforo_is_users_same( $user ) ) continue;
58
  if( ! WPF()->topic->view_access( $topic, $user ) ) continue;
@@ -77,9 +80,12 @@ class Actions {
77
  continue;
78
  }
79
 
 
 
80
  $key = 'postid_' . $post['postid'] . '_user_email_' . $user['user_email'];
81
  if( ! WPF()->ram_cache->exists( $key ) ){
82
 
 
83
  if( wpforo_is_users_same( $owner, $user ) ) continue;
84
  if( wpforo_is_users_same( $user ) ) continue;
85
  if( ! WPF()->post->view_access( $post, $user ) ) continue;
50
  continue;
51
  }
52
 
53
+ if( apply_filters( 'break_wpforo_follow_send_email_after_add_topic', false, $user, $owner, $topic, $forum ) ) continue;
54
+
55
  $key = 'topicid_' . $topic['topicid'] . '_user_email_' . $user['user_email'];
56
  if( ! WPF()->ram_cache->exists( $key ) ){
57
 
58
+ if( wpfval($user, 'status') !== 'active' ) continue;
59
  if( wpforo_is_users_same( $owner, $user ) ) continue;
60
  if( wpforo_is_users_same( $user ) ) continue;
61
  if( ! WPF()->topic->view_access( $topic, $user ) ) continue;
80
  continue;
81
  }
82
 
83
+ if( apply_filters( 'break_wpforo_follow_send_email_after_add_post', false, $user, $owner, $post, $topic ) ) continue;
84
+
85
  $key = 'postid_' . $post['postid'] . '_user_email_' . $user['user_email'];
86
  if( ! WPF()->ram_cache->exists( $key ) ){
87
 
88
+ if( wpfval($user, 'status') !== 'active' ) continue;
89
  if( wpforo_is_users_same( $owner, $user ) ) continue;
90
  if( wpforo_is_users_same( $user ) ) continue;
91
  if( ! WPF()->post->view_access( $post, $user ) ) continue;
modules/mentioning/classes/Actions.php CHANGED
@@ -40,6 +40,8 @@ class Actions {
40
  foreach( $matches as $match ) {
41
  $user = WPF()->member->get_member( $match[1] );
42
  if( ! empty( $user['user_email'] ) && ! $user['is_mention_muted'] ) {
 
 
43
  if( wpforo_is_users_same( $owner, $user ) ) continue;
44
  if( wpforo_is_users_same( $user ) ) continue;
45
  if( wpfkey( $item, 'first_postid' ) ){
40
  foreach( $matches as $match ) {
41
  $user = WPF()->member->get_member( $match[1] );
42
  if( ! empty( $user['user_email'] ) && ! $user['is_mention_muted'] ) {
43
+ if( apply_filters( 'break_wpforo_mention_send_email', false, $user, $owner, $item, $pitem ) ) continue;
44
+ if( wpfval($user, 'status') !== 'active' ) continue;
45
  if( wpforo_is_users_same( $owner, $user ) ) continue;
46
  if( wpforo_is_users_same( $user ) ) continue;
47
  if( wpfkey( $item, 'first_postid' ) ){
modules/reactions/Reactions.php CHANGED
@@ -26,20 +26,27 @@ class Reactions {
26
  }
27
 
28
  static public function get_types(){
29
- return (array) apply_filters( 'wpforo_reactions_set_types', [
30
  'up' => [
31
  'label' => wpforo_phrase( 'Like', false ),
32
  'icon' => sprintf( '<i class="far fa-thumbs-up" title="%1$s"></i>', wpforo_phrase( 'Like', false ) ),
33
  'color' => '#3f7796',
34
  'reaction' => 1,
 
35
  ],
36
  'down' => [
37
  'label' => wpforo_phrase( 'Dislike', false ),
38
  'icon' => sprintf( '<i class="far fa-thumbs-down" title="%1$s"></i>', wpforo_phrase( 'Dislike', false ) ),
39
  'color' => '#f42d2c',
40
  'reaction' => - 1,
 
41
  ],
42
  ] );
 
 
 
 
 
43
  }
44
 
45
  static public function get_type_list() {
26
  }
27
 
28
  static public function get_types(){
29
+ $types = (array) apply_filters( 'wpforo_reactions_set_types', [
30
  'up' => [
31
  'label' => wpforo_phrase( 'Like', false ),
32
  'icon' => sprintf( '<i class="far fa-thumbs-up" title="%1$s"></i>', wpforo_phrase( 'Like', false ) ),
33
  'color' => '#3f7796',
34
  'reaction' => 1,
35
+ 'order' => 0,
36
  ],
37
  'down' => [
38
  'label' => wpforo_phrase( 'Dislike', false ),
39
  'icon' => sprintf( '<i class="far fa-thumbs-down" title="%1$s"></i>', wpforo_phrase( 'Dislike', false ) ),
40
  'color' => '#f42d2c',
41
  'reaction' => - 1,
42
+ 'order' => 1,
43
  ],
44
  ] );
45
+
46
+ $order = array_column($types, 'order');
47
+ array_multisort($order, SORT_ASC, $types);
48
+
49
+ return $types;
50
  }
51
 
52
  static public function get_type_list() {
modules/reactions/classes/Template.php CHANGED
@@ -41,7 +41,7 @@ class Template {
41
  $reaction = WPF()->reaction->get_user_reaction( $post['postid'], $userid );
42
  $type = wpfval($reaction, 'type');
43
  $all = [];
44
- foreach( Reactions::get_types() as $key => $_type ){
45
  $all[$key] = sprintf(
46
  '<span class="%1$s wpf-react-%2$s" data-type="%2$s">%3$s</span>',
47
  ( $type !== $key ? 'wpf-react' : '' ),
@@ -49,7 +49,6 @@ class Template {
49
  $_type['icon']
50
  );
51
  }
52
- $up = $all['up']; unset( $all['up'] ); $all['up'] = $up;
53
  return sprintf(
54
  '<div class="wpf-reaction-wrap"><div class="wpforo-reaction wpf-popover" aria-haspopup="true" data-currentstate="%1$s">
55
  <span class="wpf-current-reaction %2$s" data-type="%1$s">%3$s</span>
@@ -62,36 +61,6 @@ class Template {
62
  );
63
  }
64
 
65
- public function _like_button( $post = [], $type = 'icon-count' ) {
66
- $login = is_user_logged_in();
67
- $button_html = '';
68
- $forumid = ( isset( $post['forumid'] ) ) ? $post['forumid'] : 0;
69
- $postid = ( isset( $post['postid'] ) ) ? $post['postid'] : 0;
70
- if( WPF()->perm->forum_can( 'l', $forumid ) && $login && WPF()->current_userid != $post['userid'] ) {
71
- $like_status = ( WPF()->reaction->is_reacted(
72
- $postid,
73
- WPF()->current_userid
74
- ) === false ? 'wpforo-like' : 'wpforo-unlike' );
75
- $like_icon = ( $like_status === 'wpforo-like' ) ? 'far' : 'fas';
76
- $icon = ( in_array( $type, ['icon','icon-text','icon-count'], true ) ) ? '<i class="' . esc_attr(
77
- $like_icon
78
- ) . ' fa-thumbs-up wpfsx wpforo-like-ico"></i>' : '';
79
- $number = ( $type === 'icon-count' ) ? '<span class="wpf-like-count">' . intval(
80
- $post['likes_count']
81
- ) . '</span>' : '';
82
- $phrase = ( $type === 'text' || $type == 'icon-text' ) ? '<span class="wpforo-like-txt">' . wpforo_phrase(
83
- str_replace( 'wpforo-', '', $like_status ),
84
- false
85
- ) . '</span>' : '';
86
- $button_html = '<span class="wpf-action ' . $like_status . '" data-postid="' . wpforo_bigintval(
87
- $postid
88
- ) . '">' . '<span class="wpf-like-icon" wpf-tooltip="' . esc_attr(
89
- wpforo_phrase( str_replace( 'wpforo-', '', $like_status ), false )
90
- ) . '">' . $icon . '</span>' . $phrase . $number . '</span>';
91
- }
92
- return $button_html;
93
- }
94
-
95
  public function likers( $postid ) {
96
  if( ! $postid ) return '';
97
 
41
  $reaction = WPF()->reaction->get_user_reaction( $post['postid'], $userid );
42
  $type = wpfval($reaction, 'type');
43
  $all = [];
44
+ foreach( array_reverse( Reactions::get_types() ) as $key => $_type ){
45
  $all[$key] = sprintf(
46
  '<span class="%1$s wpf-react-%2$s" data-type="%2$s">%3$s</span>',
47
  ( $type !== $key ? 'wpf-react' : '' ),
49
  $_type['icon']
50
  );
51
  }
 
52
  return sprintf(
53
  '<div class="wpf-reaction-wrap"><div class="wpforo-reaction wpf-popover" aria-haspopup="true" data-currentstate="%1$s">
54
  <span class="wpf-current-reaction %2$s" data-type="%1$s">%3$s</span>
61
  );
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  public function likers( $postid ) {
65
  if( ! $postid ) return '';
66
 
modules/subscriptions/classes/Actions.php CHANGED
@@ -89,11 +89,15 @@ class Actions {
89
  * subscribe_manager form submit action
90
  */
91
  public function manager() {
92
- wpforo_verify_form();
 
 
 
 
93
  $data = ( ! empty( $_POST['wpforo']['forums'] ) ? array_map( 'sanitize_title', $_POST['wpforo']['forums'] ) : [] );
94
  $all = ( ! empty( $_POST['wpforo']['check_all'] ) ? sanitize_title( $_POST['wpforo']['check_all'] ) : '' );
95
 
96
- WPF()->sbscrb->reset( $data, $all, (int) wpfval( $_POST, 'wpforo', 'userid' ) );
97
  wp_safe_redirect( wpforo_get_request_uri() );
98
  exit();
99
  }
@@ -229,6 +233,9 @@ class Actions {
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
 
@@ -273,6 +280,9 @@ class Actions {
273
  $key = 'postid_' . $post['postid'] . '_user_email_' . $user['user_email'];
274
  if( ! WPF()->ram_cache->exists( $key ) ){
275
 
 
 
 
276
  if( wpforo_is_users_same( $owner, $user ) ) continue;
277
  if( wpforo_is_users_same( $user ) ) continue;
278
 
89
  * subscribe_manager form submit action
90
  */
91
  public function manager() {
92
+ $userid = (int) wpfval( $_POST, 'wpforo', 'userid' );
93
+ wpforo_verify_form( 'wpforo_verify_form_' . $userid );
94
+
95
+ WPF()->change_board( (int) wpfval( $_POST, 'wpforo', 'boardid' ) );
96
+
97
  $data = ( ! empty( $_POST['wpforo']['forums'] ) ? array_map( 'sanitize_title', $_POST['wpforo']['forums'] ) : [] );
98
  $all = ( ! empty( $_POST['wpforo']['check_all'] ) ? sanitize_title( $_POST['wpforo']['check_all'] ) : '' );
99
 
100
+ WPF()->sbscrb->reset( $data, $all, $userid );
101
  wp_safe_redirect( wpforo_get_request_uri() );
102
  exit();
103
  }
233
  $key = 'topicid_' . $topic['topicid'] . '_user_email_' . $user['user_email'];
234
  if( ! WPF()->ram_cache->exists( $key ) ){
235
 
236
+ if( apply_filters( 'break_wpforo_subscriber_send_email_after_add_topic', false, $user, $owner, $topic, $forum ) ) continue;
237
+
238
+ if( wpfval($user, 'status') !== 'active' ) continue;
239
  if( wpforo_is_users_same( $owner, $user ) ) continue;
240
  if( wpforo_is_users_same( $user ) ) continue;
241
 
280
  $key = 'postid_' . $post['postid'] . '_user_email_' . $user['user_email'];
281
  if( ! WPF()->ram_cache->exists( $key ) ){
282
 
283
+ if( apply_filters( 'break_wpforo_subscriber_send_email_after_add_post', false, $user, $owner, $post, $topic ) ) continue;
284
+
285
+ if( wpfval($user, 'status') !== 'active' ) continue;
286
  if( wpforo_is_users_same( $owner, $user ) ) continue;
287
  if( wpforo_is_users_same( $user ) ) continue;
288
 
modules/subscriptions/classes/Template.php CHANGED
@@ -8,7 +8,7 @@ class Template {
8
  }
9
 
10
  private function init_hooks() {
11
- add_action( 'wpforo_template_profile_subscriptions_head_bar', [ $this, 'manager_form' ] );
12
  add_action( 'wpforo_template_forum_head_bar_action_links', function(){ echo $this->forum_subscribe_link(); } );
13
  add_action( 'wpforo_template_topic_head_bar_action_links', function(){ echo $this->forum_subscribe_link(); } );
14
  add_action( 'wpforo_template_post_head_bar_action_links', function(){ echo $this->topic_subscribe_link(); } );
@@ -30,9 +30,14 @@ class Template {
30
  }
31
 
32
  public function manager_form( $userid = 0 ) {
 
 
 
 
 
33
  if(
34
  (
35
- ! WPF()->current_object['user_is_same_current_user']
36
  && ! wpforo_current_user_is( 'admin' )
37
  ) || (
38
  wpforo_setting( 'subscriptions', 'subscribe_confirmation' )
@@ -40,11 +45,6 @@ class Template {
40
  && ! WPF()->sbscrb->is_email_confirmed()
41
  )
42
  ) return;
43
- $userid = intval( $userid );
44
- if( ! $userid ) {
45
- $userid = WPF()->current_object['userid'];
46
- if( ! $userid ) $userid = WPF()->current_userid;
47
- }
48
  $sbs = [];
49
  $allposts_checked = '';
50
  $alltopics_checked = '';
@@ -118,8 +118,9 @@ class Template {
118
  <p class="wpf-sbs-head"><?php wpforo_phrase( 'Subscription Manager' ) ?></p>
119
  <form id="wpf_sbs_form" method="post" enctype="multipart/form-data" action="">
120
  <input type="hidden" name="wpfaction" value="subscribe_manager">
 
121
  <input type="hidden" name="wpforo[userid]" value="<?php echo $userid ?>">
122
- <?php wp_nonce_field( 'wpforo_verify_form', '_wpfnonce' ); ?>
123
  <div class="wpf-sbs-bulk">
124
  <div class="wpf-sbs-bulk-posts">
125
  <input id="wpf_sbs_allposts" type="checkbox" name="wpforo[check_all]" value="forums-topics" <?php echo $allposts_checked ?>>
8
  }
9
 
10
  private function init_hooks() {
11
+ add_action( 'wpforo_template_profile_subscriptions_head_bar', function(){ $this->manager_form(); } );
12
  add_action( 'wpforo_template_forum_head_bar_action_links', function(){ echo $this->forum_subscribe_link(); } );
13
  add_action( 'wpforo_template_topic_head_bar_action_links', function(){ echo $this->forum_subscribe_link(); } );
14
  add_action( 'wpforo_template_post_head_bar_action_links', function(){ echo $this->topic_subscribe_link(); } );
30
  }
31
 
32
  public function manager_form( $userid = 0 ) {
33
+ $userid = intval( $userid );
34
+ if( ! $userid ) {
35
+ $userid = WPF()->current_object['userid'];
36
+ if( ! $userid ) $userid = WPF()->current_userid;
37
+ }
38
  if(
39
  (
40
+ WPF()->current_userid !== $userid
41
  && ! wpforo_current_user_is( 'admin' )
42
  ) || (
43
  wpforo_setting( 'subscriptions', 'subscribe_confirmation' )
45
  && ! WPF()->sbscrb->is_email_confirmed()
46
  )
47
  ) return;
 
 
 
 
 
48
  $sbs = [];
49
  $allposts_checked = '';
50
  $alltopics_checked = '';
118
  <p class="wpf-sbs-head"><?php wpforo_phrase( 'Subscription Manager' ) ?></p>
119
  <form id="wpf_sbs_form" method="post" enctype="multipart/form-data" action="">
120
  <input type="hidden" name="wpfaction" value="subscribe_manager">
121
+ <input type="hidden" name="wpforo[boardid]" value="<?php echo WPF()->board->get_current( 'boardid' ) ?>">
122
  <input type="hidden" name="wpforo[userid]" value="<?php echo $userid ?>">
123
+ <?php wp_nonce_field( 'wpforo_verify_form_' . $userid, '_wpfnonce' ); ?>
124
  <div class="wpf-sbs-bulk">
125
  <div class="wpf-sbs-bulk-posts">
126
  <input id="wpf_sbs_allposts" type="checkbox" name="wpforo[check_all]" value="forums-topics" <?php echo $allposts_checked ?>>
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.1
6
- Stable tag: 2.1.1
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,10 +163,23 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
163
 
164
  == Changelog ==
165
 
166
- = wpForo Forum 2.1.0 - 2.1.1 | 10.11.2022 =
167
-
168
- [wpForo Forum v2.1.0 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-2-1-0-is-released/)
169
-
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  * Version 2.1.1
171
  * Changed: Correct location of reply editor after clicking the edit reply button
172
  * Changed: Keep the regular loading type of widgets. AJAX is only used for multi-board forums when current board doesn't match to the board widget.
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 5.1
5
  Tested up to: 6.1
6
+ Stable tag: 2.1.2
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.1.0 - 2.1.2 | 13.12.2022 =
167
+
168
+ [wpForo Forum v2.1 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-2-1-0-is-released/)
169
+
170
+ * Version 2.1.2
171
+ * Fixed Bug: Let users create and edit questions with empty content
172
+ * Fixed Bug: Email sending issues with internal cache
173
+ * Fixed Bug: Do not send email notification to inactive users
174
+ * Fixed Bug: Adjust "Can subscribe" permission to control users subscription tab
175
+ * Fixed Bug: Problem with Subscribe Manager form for multi-boards
176
+ * Fixed Bug: PHP property_exists() problem when settings have not initialized yet
177
+ * Fixed Bug: Reactions ordering problem
178
+ * Fixed Bug: Popup message problem on password reset page
179
+ * Fixed Bug: Issue with some email shortcides
180
+ * Fixed Bug: Problem with rendering of quotes on pop-up messages of topic overview
181
+ * Fixed Bug: Prevent creating topics with empty title.
182
+ * --------
183
  * Version 2.1.1
184
  * Changed: Correct location of reply editor after clicking the edit reply button
185
  * Changed: Keep the regular loading type of widgets. AJAX is only used for multi-board forums when current board doesn't match to the board widget.
themes/2022/style-rtl.css CHANGED
@@ -1,6 +1,7 @@
1
  /*
2
  RTL Style of Classic Theme
3
  */
 
4
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
5
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
6
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
@@ -247,9 +248,7 @@ RTL Style of Classic Theme
247
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
248
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
249
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
250
- #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-head,
251
- #wpforo #wpforo-wrap .wpforo-comment .wpforo-post-quote-head,
252
- #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
253
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
254
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
255
  #wpforo #wpforo-wrap .wpforo-post code,
1
  /*
2
  RTL Style of Classic Theme
3
  */
4
+ body.is_wpforo_page-1, html{ overflow-y: scroll; scroll-behavior: smooth; }
5
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
6
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
7
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
248
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
249
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
250
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
251
+ .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
 
 
252
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
253
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
254
  #wpforo #wpforo-wrap .wpforo-post code,
themes/2022/style.css CHANGED
@@ -6,7 +6,7 @@ Theme URI: http://wpforo.com
6
  Author: gVectors Team
7
  */
8
 
9
-
10
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
11
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
12
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
@@ -253,9 +253,7 @@ Author: gVectors Team
253
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
254
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
255
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
256
- #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-head,
257
- #wpforo #wpforo-wrap .wpforo-comment .wpforo-post-quote-head,
258
- #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
259
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
260
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
261
  #wpforo #wpforo-wrap .wpforo-post code,
6
  Author: gVectors Team
7
  */
8
 
9
+ body.is_wpforo_page-1, html{ overflow-y: scroll; scroll-behavior: smooth; }
10
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
11
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
12
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
253
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
254
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
255
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
256
+ .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
 
 
257
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
258
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
259
  #wpforo #wpforo-wrap .wpforo-post code,
themes/classic/style-rtl.css CHANGED
@@ -1,7 +1,7 @@
1
  /*
2
  RTL Style of Classic Theme
3
  */
4
-
5
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
6
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
7
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
@@ -233,9 +233,7 @@ RTL Style of Classic Theme
233
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
234
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
235
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
236
- #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-head,
237
- #wpforo #wpforo-wrap .wpforo-comment .wpforo-post-quote-head,
238
- #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
239
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
240
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
241
  #wpforo #wpforo-wrap .wpforo-post code,
1
  /*
2
  RTL Style of Classic Theme
3
  */
4
+ body.is_wpforo_page-1, html{ overflow-y: scroll; scroll-behavior: smooth; }
5
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
6
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
7
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
233
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
234
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
235
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
236
+ .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
 
 
237
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
238
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
239
  #wpforo #wpforo-wrap .wpforo-post code,
themes/classic/style.css CHANGED
@@ -6,7 +6,7 @@ Theme URI: http://wpforo.com
6
  Author: gVectors Team
7
  */
8
 
9
-
10
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
11
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
12
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
@@ -238,9 +238,7 @@ Author: gVectors Team
238
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
239
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
240
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
241
- #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-head,
242
- #wpforo #wpforo-wrap .wpforo-comment .wpforo-post-quote-head,
243
- #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
244
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
245
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
246
  #wpforo #wpforo-wrap .wpforo-post code,
6
  Author: gVectors Team
7
  */
8
 
9
+ body.is_wpforo_page-1, html{ overflow-y: scroll; scroll-behavior: smooth; }
10
  #wpforo #wpforo-wrap .wpforo-main{clear:both;}
11
  #wpforo #wpforo-wrap.wpf-dark{ padding:30px; margin:2px;}
12
  #wpforo #wpforo-wrap .wpforo-subtop{display: block!important; position: relative;}
238
  #wpforo #wpforo-wrap .wpforo-revision-body blockquote{display:block; margin:5px 0 15px 0; width:90%; padding:10px; font-size:13px;}
239
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-quote-author,
240
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-quote-author{padding:5px 0; font-weight:bold;}
241
+ .wpforo-post-quote-head{ display: flex; justify-content: space-between; flex-wrap: nowrap; }
 
 
242
  #wpforo #wpforo-wrap .wpforo-post .wpforo-post-code,
243
  #wpforo #wpforo-wrap .wpforo-revision-body .wpforo-post-code{max-width:90%; overflow-x:auto; padding:5px 10px 15px 10px; margin:10px 0; font-size:12px }
244
  #wpforo #wpforo-wrap .wpforo-post code,
widgets/RecentPosts.php CHANGED
@@ -93,7 +93,7 @@ class RecentPosts extends WP_Widget {
93
  </a>
94
  <?php if( ! $current && $instance['display_new_indicator'] ) wpforo_unread_button( $post['topicid'], '', true, $post['postid'] ) ?>
95
  </p>
96
- <p class="posttext"><?php echo esc_html( wpforo_text( $post['body'], $instance['excerpt_length'] ) ); ?></p>
97
  <p class="postuser"><?php wpforo_phrase( 'by' ) ?> <?php wpforo_member_link( $member ) ?>
98
  , <?php esc_html( wpforo_date( $post['created'] ) ) ?></p>
99
  </div>
93
  </a>
94
  <?php if( ! $current && $instance['display_new_indicator'] ) wpforo_unread_button( $post['topicid'], '', true, $post['postid'] ) ?>
95
  </p>
96
+ <p class="posttext"><?php echo esc_html( wpforo_text( $post['body'], $instance['excerpt_length'], false ) ); ?></p>
97
  <p class="postuser"><?php wpforo_phrase( 'by' ) ?> <?php wpforo_member_link( $member ) ?>
98
  , <?php esc_html( wpforo_date( $post['created'] ) ) ?></p>
99
  </div>
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.1.1
9
  * Text Domain: wpforo
10
  * Domain Path: /languages
11
  */
12
 
13
  namespace wpforo;
14
 
15
- define( 'WPFORO_VERSION', '2.1.1' );
16
 
17
  //Exit if accessed directly
18
  if( ! defined( 'ABSPATH' ) ) exit;
@@ -515,6 +515,8 @@ final class wpforo {
515
  }
516
 
517
  public function shortcode_atts_to_url( $atts ) {
 
 
518
  $url = wpforo_home_url();
519
 
520
  $args = shortcode_atts(
@@ -557,6 +559,8 @@ final class wpforo {
557
  }
558
 
559
  public function init_current_url( $atts = [] ) {
 
 
560
  if( is_scalar( $atts ) ) {
561
  $url = $atts;
562
  $atts = [];
@@ -865,7 +869,7 @@ final class wpforo {
865
  array_pop( $wpf_url_parse );
866
  array_push( $wpf_url_parse, $nickname, $profile_route );
867
  } else {
868
- if( ! in_array( end( $wpf_url_parse ), $templates ) ) $wpf_url_parse[] = wpforo_settings_get_slug( 'profile' );
869
  }
870
  }
871
  $__slug = end( $wpf_url_parse );
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.1.2
9
  * Text Domain: wpforo
10
  * Domain Path: /languages
11
  */
12
 
13
  namespace wpforo;
14
 
15
+ define( 'WPFORO_VERSION', '2.1.2' );
16
 
17
  //Exit if accessed directly
18
  if( ! defined( 'ABSPATH' ) ) exit;
515
  }
516
 
517
  public function shortcode_atts_to_url( $atts ) {
518
+ if( is_null( $this->forum ) ) $this->init_classes();
519
+
520
  $url = wpforo_home_url();
521
 
522
  $args = shortcode_atts(
559
  }
560
 
561
  public function init_current_url( $atts = [] ) {
562
+ if( is_null( $this->post ) ) $this->init_classes();
563
+
564
  if( is_scalar( $atts ) ) {
565
  $url = $atts;
566
  $atts = [];
869
  array_pop( $wpf_url_parse );
870
  array_push( $wpf_url_parse, $nickname, $profile_route );
871
  } else {
872
+ if( ! in_array( end( $wpf_url_parse ), array_map( 'wpforo_settings_get_slug', $templates ) ) ) $wpf_url_parse[] = wpforo_settings_get_slug( 'profile' );
873
  }
874
  }
875
  $__slug = end( $wpf_url_parse );