wpForo Forum - Version 1.7.6

Version Description

Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.6

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: 4.1
5
  Tested up to: 5.4
6
- Stable tag: 1.7.5
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -165,12 +165,17 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
165
 
166
  == Changelog ==
167
 
168
- = wpForo Forum 1.7.5 | 29.05.2020 =
169
 
170
- [wpForo Forum v1.7.5 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-5-is-released/)
171
 
172
  With this version of wpForo, we've improved the [wpForo - User Custom Fields](https://gvectors.com/product/wpforo-user-custom-fields/) addon. Besides the ability to create custom fields for users, now this addon allows you to create Custom Profile Tabs. This is a major change in the addon which required wpForo core update as well.
173
 
 
 
 
 
 
174
  * Added: New permission `Can reply to own topic` in Forum Accesses
175
  * Added: New `[post-desc]` shortcode for user mentioning email template
176
  * Added: New merged Profile Page option [ Default | wpForo | BP | UM ]
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 4.1
5
  Tested up to: 5.4
6
+ Stable tag: 1.7.6
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
165
 
166
  == Changelog ==
167
 
168
+ = wpForo Forum 1.7.5 / 1.7.6 | 30.05.2020 =
169
 
170
+ [wpForo Forum v1.7.5 / 1.7.6 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-5-is-released/)
171
 
172
  With this version of wpForo, we've improved the [wpForo - User Custom Fields](https://gvectors.com/product/wpforo-user-custom-fields/) addon. Besides the ability to create custom fields for users, now this addon allows you to create Custom Profile Tabs. This is a major change in the addon which required wpForo core update as well.
173
 
174
+ * wpForo Forum v1.7.6
175
+ * Fixed Bug: Warning: Illegal offset type in class-members.php on line 2641
176
+ * Fixed Bug: Other small bugs
177
+ * -----------
178
+ * wpForo Forum v1.7.5
179
  * Added: New permission `Can reply to own topic` in Forum Accesses
180
  * Added: New `[post-desc]` shortcode for user mentioning email template
181
  * Added: New merged Profile Page option [ Default | wpForo | BP | UM ]
wpf-includes/class-forms.php CHANGED
@@ -769,10 +769,9 @@ class wpForoForm{
769
  $f['field_class'] = sanitize_text_field( $f['name'] );
770
 
771
  //varname
772
- $vn = wpfval( WPF()->data, 'varname');
773
- $f['varname'] = $f['isDefault'] && $vn ? $vn : 'data';
774
 
775
- //template
776
  $f['template'] = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
777
 
778
  //value
769
  $f['field_class'] = sanitize_text_field( $f['name'] );
770
 
771
  //varname
772
+ $f['varname'] = $f['isDefault'] ? (string) wpfval( WPF()->data, 'varname') : 'data';
 
773
 
774
+ //template
775
  $f['template'] = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
776
 
777
  //value
wpf-includes/class-members.php CHANGED
@@ -1245,8 +1245,18 @@ class wpForoMember{
1245
  $wheres = array();
1246
 
1247
  foreach($fields as $field){
 
1248
  $field = sanitize_text_field($field);
1249
- $wheres[] = "`".esc_sql($field)."` LIKE '%" . esc_sql($needle) ."%'";
 
 
 
 
 
 
 
 
 
1250
  }
1251
 
1252
  if(!empty($wheres)){
@@ -1270,9 +1280,41 @@ class wpForoMember{
1270
  $wheres = array();
1271
 
1272
  foreach($args as $field => $needle){
 
1273
  $field = sanitize_text_field($field);
1274
- $needle = sanitize_text_field($needle);
1275
- $wheres[] = "`".esc_sql($field)."` LIKE '%" . esc_sql($needle) ."%'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1276
  }
1277
 
1278
  if($wheres){
@@ -2625,7 +2667,11 @@ class wpForoMember{
2625
  }
2626
 
2627
  public function is_field($field){
2628
- return wpfval($field, 'fieldKey') && wpfval($field, 'type') && wpfval($field, 'isDefault');
 
 
 
 
2629
  }
2630
 
2631
  public function fields_structure_full_array($fields, $need_password = null ){
@@ -2638,7 +2684,8 @@ class wpForoMember{
2638
  foreach( $row as $kc => $cols ){
2639
  if( is_array($cols) ){
2640
  foreach( $cols as $kf => $field ){
2641
- $fs[$kr][$kc][$field] = $this->get_field($field);
 
2642
  }
2643
  }
2644
  }
@@ -2651,13 +2698,14 @@ class wpForoMember{
2651
  foreach( $row as $kc => $cols ){
2652
  if( is_array($cols) ){
2653
  foreach( $cols as $kf => $field ){
 
2654
  if( $field === 'user_pass' ){
2655
  if($need_password){
2656
  $has_password = true;
2657
- $fs[$kr][$kc][$field] = $this->get_field($field);
2658
  }
2659
  }else{
2660
- $fs[$kr][$kc][$field] = $this->get_field($field);
2661
  }
2662
  }
2663
  }
@@ -2808,7 +2856,7 @@ class wpForoMember{
2808
  foreach ($fields as $row_key => $row){
2809
  foreach ($row as $col_key => $col){
2810
  foreach ($col as $field_key => $field){
2811
- if( !$field['isDefault'] ) continue;
2812
  $names[] = $field['name'];
2813
  }
2814
  }
1245
  $wheres = array();
1246
 
1247
  foreach($fields as $field){
1248
+ $f = $this->get_field($field);
1249
  $field = sanitize_text_field($field);
1250
+ if( $f['isDefault'] ){
1251
+ $wheres[] = "`".esc_sql($field)."` LIKE '%" . esc_sql($needle) ."%'";
1252
+ }else{
1253
+ $needle = preg_quote(preg_quote($needle));
1254
+ if( in_array($f['type'], array('text','search','textarea'), true) ){
1255
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"[^\"]*". esc_sql($needle) ."[^\"]*\"'";
1256
+ }else{
1257
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"". esc_sql($needle) ."\"'";
1258
+ }
1259
+ }
1260
  }
1261
 
1262
  if(!empty($wheres)){
1280
  $wheres = array();
1281
 
1282
  foreach($args as $field => $needle){
1283
+ $f = $this->get_field($field);
1284
  $field = sanitize_text_field($field);
1285
+ if( $f['isDefault'] ){
1286
+ if( is_scalar($needle) ){
1287
+ $needle = sanitize_text_field($needle);
1288
+ $wheres[] = "`".esc_sql($field)."` LIKE '%" . esc_sql($needle) ."%'";
1289
+ }elseif( is_array($needle) ){
1290
+ foreach ($needle as $n){
1291
+ $n = sanitize_text_field($n);
1292
+ $wheres[] = "`".esc_sql($field)."` LIKE '%" . esc_sql($n) ."%'";
1293
+ }
1294
+ }
1295
+ }else{
1296
+ if( in_array($f['type'], array('text','search','textarea'), true) ){
1297
+ if( is_scalar($needle) ){
1298
+ $needle = preg_quote(preg_quote($needle));
1299
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"[^\"]*". esc_sql($needle) ."[^\"]*\"'";
1300
+ }elseif( is_array($needle) ){
1301
+ foreach ($needle as $n){
1302
+ $n = preg_quote(preg_quote($n));
1303
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"[^\"]*". esc_sql($n) ."[^\"]*\"'";
1304
+ }
1305
+ }
1306
+ }else{
1307
+ if( is_scalar($needle) ){
1308
+ $needle = preg_quote(preg_quote($needle));
1309
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"". esc_sql($needle) ."\"'";
1310
+ }elseif( is_array($needle) ){
1311
+ foreach ($needle as $n){
1312
+ $n = preg_quote(preg_quote($n));
1313
+ $wheres[] = "`fields` REGEXP '[{,]\"". $field ."\":(\\\[[^\\\[]*)?\"". esc_sql($n) ."\"'";
1314
+ }
1315
+ }
1316
+ }
1317
+ }
1318
  }
1319
 
1320
  if($wheres){
2667
  }
2668
 
2669
  public function is_field($field){
2670
+ return wpfval($field, 'fieldKey') && wpfval($field, 'type') && wpfkey($field, 'isDefault');
2671
+ }
2672
+
2673
+ public function get_field_key($field) {
2674
+ return is_string($field) ? $field : (string) wpfval($field, 'fieldKey');
2675
  }
2676
 
2677
  public function fields_structure_full_array($fields, $need_password = null ){
2684
  foreach( $row as $kc => $cols ){
2685
  if( is_array($cols) ){
2686
  foreach( $cols as $kf => $field ){
2687
+ $field_key = $this->get_field_key($field);
2688
+ $fs[$kr][$kc][$field_key] = $this->get_field($field);
2689
  }
2690
  }
2691
  }
2698
  foreach( $row as $kc => $cols ){
2699
  if( is_array($cols) ){
2700
  foreach( $cols as $kf => $field ){
2701
+ $field_key = $this->get_field_key($field);
2702
  if( $field === 'user_pass' ){
2703
  if($need_password){
2704
  $has_password = true;
2705
+ $fs[$kr][$kc][$field_key] = $this->get_field($field);
2706
  }
2707
  }else{
2708
+ $fs[$kr][$kc][$field_key] = $this->get_field($field);
2709
  }
2710
  }
2711
  }
2856
  foreach ($fields as $row_key => $row){
2857
  foreach ($row as $col_key => $col){
2858
  foreach ($col as $field_key => $field){
2859
+ if( $only_defaults && !$field['isDefault'] ) continue;
2860
  $names[] = $field['name'];
2861
  }
2862
  }
wpf-themes/classic/members.php CHANGED
@@ -10,7 +10,6 @@
10
  <?php if( WPF()->perm->usergroup_can('vmem') ): ?>
11
  <div class="wpf-table wpforo-members-search wpfbg-9">
12
  <form action="<?php echo wpforo_home_url(wpforo_get_template_slug('members')) ?>" method="get">
13
- <?php wpforo_make_hidden_fields_from_url( wpforo_home_url(wpforo_get_template_slug('members')) ) ?>
14
  <?php wpforo_fields( $fields ); ?>
15
  <div class="wpf-tr">
16
  <div class="wpf-td wpfw-1">
10
  <?php if( WPF()->perm->usergroup_can('vmem') ): ?>
11
  <div class="wpf-table wpforo-members-search wpfbg-9">
12
  <form action="<?php echo wpforo_home_url(wpforo_get_template_slug('members')) ?>" method="get">
 
13
  <?php wpforo_fields( $fields ); ?>
14
  <div class="wpf-tr">
15
  <div class="wpf-td wpfw-1">
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: 1.7.5
9
  * Text Domain: wpforo
10
  * Domain Path: /wpf-languages
11
  */
12
 
13
  //Exit if accessed directly
14
  if( !defined( 'ABSPATH' ) ) exit;
15
- if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.7.5');
16
 
17
  function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
  add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
@@ -790,10 +790,12 @@ if( !class_exists( 'wpForo' ) ) {
790
  if($wpfms){
791
  $users_include = $this->member->search($wpfms, $search_fields_names);
792
  }else{
793
- if( $filters = array_filter($get) ){
 
 
794
  $args = array();
795
  foreach ($filters as $filter_key => $filter){
796
- if( in_array($filter_key, (array) $search_fields_names) && !is_array($filter) ){
797
  $args[$filter_key] = $filter;
798
  }
799
  }
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: 1.7.6
9
  * Text Domain: wpforo
10
  * Domain Path: /wpf-languages
11
  */
12
 
13
  //Exit if accessed directly
14
  if( !defined( 'ABSPATH' ) ) exit;
15
+ if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.7.6');
16
 
17
  function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
  add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
790
  if($wpfms){
791
  $users_include = $this->member->search($wpfms, $search_fields_names);
792
  }else{
793
+ if( $filters = array_filter($get, function($v){return !( is_null($v) || $v === false || $v === '' );}) ){
794
+ $filters = array_merge( array_filter((array) wpfval($get, 'data'), function($v){return !( is_null($v) || $v === false || $v === '' );}), $filters );
795
+ unset($filters['data']);
796
  $args = array();
797
  foreach ($filters as $filter_key => $filter){
798
+ if( in_array($filter_key, (array) $search_fields_names) ){
799
  $args[$filter_key] = $filter;
800
  }
801
  }