Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/09/2021 02:01:40 PM (4 years ago)
Author:
espellcaste
Message:

Improving the group member count routine and the function helper.

The group member count routine was updated to avoid direct, uncached, SQL query and unnecessary cache refresh when a group's Members page was viewed.

is now being used to get the group member count which takes into account users' existence in the site,

the query is now cached and filterable.

was also updated to get the current group from if available.

Props imath
Fixes #7614 and see #6749

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-component.php

    r13101 r13103  
    266266            }
    267267
     268            // Make sure the Group ID is an integer.
     269            $this->current_group->id = (int) $this->current_group->id;
     270
    268271            // When in a single group, the first action is bumped down one because of the
    269272            // group name, so we need to adjust this and set the group name to current_item.
     
    281284            // If the user is not an admin, check if they are a moderator.
    282285            if ( ! bp_is_item_admin() ) {
    283                 bp_update_is_item_mod  ( groups_is_user_mod  ( bp_loggedin_user_id(), $this->current_group->id ), 'groups' );
     286                bp_update_is_item_mod( groups_is_user_mod( bp_loggedin_user_id(), $this->current_group->id ), 'groups' );
    284287            }
    285288
    286289            // Check once if the current group has a custom front template.
    287290            $this->current_group->front_template = bp_groups_get_front_template( $this->current_group );
     291
     292            /**
     293             * Fires once the `current_group` global is fully set.
     294             *
     295             * @since 10.0.0
     296             *
     297             * @param BP_Groups_Group|object $current_group The current group object.
     298             */
     299            do_action_ref_array( 'bp_groups_set_current_group', array( $this->current_group ) );
    288300
    289301            // Initialize the nav for the groups component.
Note: See TracChangeset for help on using the changeset viewer.