[buddypress-trac] [BuddyPress Trac] #7614: Group member count routine is bad

buddypress-trac noreply at wordpress.org
Mon Sep 6 22:56:19 UTC 2021


#7614: Group member count routine is bad
-------------------------------------------------+-------------------------
 Reporter:  boonebgorges                         |       Owner:
                                                 |  espellcaste
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  10.0.0
Component:  Groups                               |     Version:  1.2.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests dev-reviewed 2nd-     |
  opinion                                        |
-------------------------------------------------+-------------------------
Changes (by imath):

 * keywords:  has-unit-tests dev-reviewed needs-refresh => has-unit-tests
     dev-reviewed 2nd-opinion


Comment:

 Hi @espellcaste

 Once I've seen the changes about checking the current group, I realized we
 were duplicating 3 times the same code. Sorry for realizing it late. I
 believe we should improve `bp_get_group()` instead. That's mainly what I'm
 suggesting into
 [https://buddypress.trac.wordpress.org/attachment/ticket/7614/7614.4.recommandations.patch
 7614.4.recommandations.patch]. I've moved the template's global check
 earlier to always try to use a group object we already got before
 requesting it via the DB. I've noticed some template functions were using
 `0` as the parameter, eg: `bp_core_get_iso8601_date(
 bp_get_group_last_active( 0, array( 'relative' => false ) ) )` In this
 case 0 is numeric and the template's global was not used with the previous
 code of `bp_get_group()`.

 You might wonder why I'm introducing the `'bp_groups_set_current_group'`
 hook. That's to:
 - take in account early BP Rewrites need (the current group is set later
 during `bp_parse_request`. So it's a way to avoid the BP Rewrites plugin
 to generate doing it wrong notices.
 - make sure the current group had a chance to be set before checking it.

 Otherwise, the rest of the patch looks good. That's why I applied your
 patch and generated the .recommandations.patch after

 You'll probably need to reference #6749 if you agree with these changes.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7614#comment:7>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list