Plugin Directory

Changeset 3490458


Ignore:
Timestamp:
03/25/2026 02:36:34 AM (9 days ago)
Author:
itthinx
Message:

version 4.1.0

Location:
groups/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • groups/trunk/changelog.txt

    r3473982 r3490458  
    11== Groups by itthinx - changelog.txt
     2
     32026-03-24 - version 4.1.0
     4* Update - WordPress 6.9 compatible.
     5* Update - WooCommerce 10.6 compatible.
     6* Update - Resolves an issue that would render wrong post counts and all post statuses under Forums > All Forums with bbPress due to it altering the post_status of a query indiscriminately during the pre_get_posts action.
     7* Update - Using unlimited options for Tom Select UI control by default.
     8* Add - Added the groups_uie_render_select_display_limit filter.
    29
    3102026-03-03 - version 4.0.0
  • groups/trunk/groups.php

    r3473982 r3490458  
    2222 * Plugin URI: https://www.itthinx.com/plugins/groups
    2323 * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
    24  * Version: 4.0.0
     24 * Version: 4.1.0
    2525 * Requires at least: 6.7
    2626 * Requires PHP: 7.4
    2727 * WC requires at least: 10.0
    28  * WC tested up to: 10.5
     28 * WC tested up to: 10.6
    2929 * Author: itthinx
    3030 * Author URI: https://www.itthinx.com
     
    3737    exit;
    3838}
    39 define( 'GROUPS_CORE_VERSION', '4.0.0' );
     39define( 'GROUPS_CORE_VERSION', '4.1.0' );
    4040define( 'GROUPS_FILE', __FILE__ );
    4141if ( !defined( 'GROUPS_CORE_DIR' ) ) {
  • groups/trunk/lib/access/class-groups-post-access.php

    r3473982 r3490458  
    944944                        }
    945945                    }
     946                    do_action( 'groups_post_access_wp_count_posts_before_query', $query_args, $counts, $type, $perm );
    946947                    $posts = get_posts( $query_args );
     948                    do_action( 'groups_post_access_wp_count_posts_after_query', $query_args, $counts, $type, $perm );
    947949                    $count = count( $posts );
    948950                    unset( $posts );
  • groups/trunk/lib/extra/class-groups-extra.php

    r3473982 r3490458  
    2828 */
    2929class Groups_Extra {
     30
     31    /**
     32     * bbPress pre_get_posts filter priority.
     33     *
     34     * @since 4.1.0
     35     *
     36     * @var int
     37     */
     38    private static $bbp_pre_get_posts_priority = null;
     39
     40    /**
     41     * Post status before bbPress alters.
     42     *
     43     * @since 4.1.0
     44     *
     45     * @var string|string[]
     46     */
     47    private static $bbp_pre_get_posts_post_status = null;
    3048
    3149    /**
     
    4664        add_filter( 'groups_post_access_posts_where_query_get_post_types', array( __CLASS__, 'groups_post_access_posts_where_query_get_post_types' ), 10, 3 );
    4765        add_filter( 'woocommerce_duplicate_product_capability', array( __CLASS__, 'woocommerce_duplicate_product_capability' ) );
     66        add_filter( 'groups_post_access_wp_count_posts_before_query', array( __CLASS__, 'groups_post_access_wp_count_posts_before_query' ), 10, 4 );
     67        add_filter( 'groups_post_access_wp_count_posts_after_query', array( __CLASS__, 'groups_post_access_wp_count_posts_after_query' ), 10, 4 );
    4868    }
    4969
     
    190210        return $capability;
    191211    }
     212
     213    /**
     214     * Fires before get_posts query.
     215     *
     216     * @since 4.1.0
     217     *
     218     * @param array $query_args
     219     * @param object $counts
     220     * @param string $type
     221     * @param string $perm
     222     */
     223    public static function groups_post_access_wp_count_posts_before_query( $query_args, $counts, $type, $perm ) {
     224        // Workaound issue introduced by bbPress action on pre_get_posts which introduces additional types ... related https://bbpress.trac.wordpress.org/ticket/2512
     225        if ( $type === 'forum' ) {
     226            $priority = has_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility' );
     227            if ( $priority !== false ) {
     228                // Instead of removing the action, we revert the altered post_status:
     229                // remove_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', $priority );
     230                add_action( 'pre_get_posts', array( __CLASS__, 'bbp_fix_pre_get_posts' ), $priority + 1 );
     231                self::$bbp_pre_get_posts_priority = $priority;
     232                self::$bbp_pre_get_posts_post_status = $query_args['post_status'];
     233            }
     234        }
     235    }
     236
     237    /**
     238     * Fires after get_posts query.
     239     *
     240     * @since 4.1.0
     241     *
     242     * @param array $query_args
     243     * @param object $counts
     244     * @param string $type
     245     * @param string $perm
     246     */
     247    public static function groups_post_access_wp_count_posts_after_query( $query_args, $counts, $type, $perm ) {
     248        if ( self::$bbp_pre_get_posts_priority !== null ) {
     249            // see note in ...before... action
     250            // add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', self::$bbp_pre_get_posts_priority );
     251            remove_action( 'pre_get_posts', array( __CLASS__, 'bbp_fix_pre_get_posts' ), self::$bbp_pre_get_posts_priority + 1 );
     252            self::$bbp_pre_get_posts_priority = null;
     253            self::$bbp_pre_get_posts_post_status = null;
     254        }
     255    }
     256
     257    /**
     258     * Reestablish altered post_status.
     259     *
     260     * @since 4.1.0
     261     *
     262     * @param WP_Query $query
     263     */
     264    public static function bbp_fix_pre_get_posts( $query ) {
     265        if ( self::$bbp_pre_get_posts_post_status !== null ) {
     266            $query->set( 'post_status', self::$bbp_pre_get_posts_post_status );
     267        }
     268    }
    192269}
    193270Groups_Extra::boot();
  • groups/trunk/lib/views/class-groups-uie.php

    r3473982 r3490458  
    145145                    break;
    146146                default:
     147                    /**
     148                     * Allows to determine the maximum number of options displayed in the dropdown.
     149                     *
     150                     * Provide a number > 0, or null for no limit.
     151                     * Defaults to null for unlimited options displayed.
     152                     * This limits the number of options that are displayed, but not the total available options.
     153                     *
     154                     * @since 4.1.0
     155                     *
     156                     * @param int|null $max_options
     157                     */
     158                    $max_options = apply_filters( 'groups_uie_render_select_display_limit', null );
     159                    if ( is_numeric( $max_options ) ) {
     160                        $max_options = max( 1, intval( $max_options ) );
     161                    } else {
     162                        $max_options = null;
     163                    }
    147164                    $call_output .= 'if ( typeof jQuery !== "undefined" && typeof tomSelect === "function" ) {';
    148165                    $call_output .= sprintf(
    149                         'tomSelect("%s",{%splugins: ["remove_button","clear_button"],wrapperClass:"groups-ts-wrapper",controlClass:"groups-ts-control",dropdownClass:"groups-ts-dropdown",dropdownContentClass:"groups-ts-dropdown-content"});',
     166                        'tomSelect("%s",{%splugins: ["remove_button","clear_button"],maxOptions:%s,wrapperClass:"groups-ts-wrapper",controlClass:"groups-ts-control",dropdownClass:"groups-ts-dropdown",dropdownContentClass:"groups-ts-dropdown-content"});',
    150167                        $selector,
    151                         $create ? 'create:true,' : ''
    152                         );
     168                        $create ? 'create:true,' : '',
     169                        $max_options === null ? 'null' : $max_options
     170                    );
    153171                    $call_output .= '}';
    154172                    break;
  • groups/trunk/readme.txt

    r3473982 r3490458  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 4.0.0
     8Stable tag: 4.1.0
    99License: GPLv3
    1010
Note: See TracChangeset for help on using the changeset viewer.