Skip to:
Content

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#8012 closed defect (bug) (fixed)

BP 4.0: Fatal Error re add new members in wp-admin > Groups > Group > Edit

Reported by: shanebp Owned by: boonebgorges
Milestone: 4.1.0 Priority: normal
Severity: major Version:
Component: Groups Keywords: needs-patch
Cc: shane@…

Description

This error does not appear in BP 3.2.0
It occurs in BP 4.0
Go to dashboard > Groups > Group > Edit and see this error under Add Members

Fatal error: Uncaught Error: Call to undefined function wp_is_large_network() in
 /srv/www/wordpress-default/public_html/wp-content/plugins/buddypress.4.0/bp-groups/bp-groups-admin.php:864 Stack trace: 
 #0 /srv/www/wordpress-default/public_html/wp-admin/includes/template.php(1073): bp_groups_admin_edit_metabox_add_new_members(Object(BP_Groups_Group), 
 Array) 
 #1 /srv/www/wordpress-default/public_html/wp-content/plugins/buddypress.4.0/bp-groups/bp-groups-admin.php(647): 
 do_meta_boxes(Object(WP_Screen), 'normal', Object(BP_Groups_Group)) 
 #2 /srv/www/wordpress-default/public_html/wp-content/plugins/buddypress.4.0/bp-groups/bp-groups-admin.php(490): bp_groups_admin_edit() 
 #3 /srv/www/wordpress-default/public_html/wp-includes/class-wp-hook.php(286): bp_groups_admin('') 
 #4 /srv/www/wordpress-default/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) 
 #5 /srv/www/wordpress-default/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) 
 #6 /srv/www/wordpress-default/public_html/wp-admin/admin. in /srv/www/wordpress-default/public_html/wp-content/plugins/buddypress.4.0/bp-groups/bp-groups-admin.php on line 864

Attachments (3)

bp-groups-admin.php.patch (607 bytes) - added by shanebp 3 months ago.
add is_multisite() to conditional
8012.2.diff (3.3 KB) - added by dcavins 3 months ago.
Add an is_large_network check that works on single sites and networks.
8012.3.diff (2.3 KB) - added by johnjamesjacoby 3 months ago.

Download all attachments as: .zip

Change History (11)

#1 @boonebgorges
3 months ago

  • Milestone changed from Awaiting Review to 4.1.0

Thanks for the report @shanebp. I guess this didn't get wrapped in a multisite check. We'll need to push out a 4.0.1 (or 4.1.0? I don't understand our new version numbering scheme @djpaul) in the upcoming days to fix.

#2 @boonebgorges
3 months ago

  • Keywords needs-patch added

I can't do this until at least Monday, Dec 3, but someone else could.

@shanebp
3 months ago

add is_multisite() to conditional

#3 @DJPaul
3 months ago

x.y.z =

x = "new feature(s) release"
y = "bug fix"
z = "security"

so 4.1.0 yes. Last digit for security releases only.

#4 @dcavins
3 months ago

I propose that we provide an is_large_network() check that works for multisite and single-site installations, because it's handy, and single BP sites can easily exceed 10,000 users. I'm attaching a patch that introduces bp_is_large_network() which is a wrapper for wp_is_large_network() when it's available but also works for single sites. The only doubt I have is that I have added a new filter hook, bp_is_large_network, but it is tempting to use the wp_is_large_network hook for ease of development. Good idea? Or is it gauche to piggyback on existing filter hooks?

@dcavins
3 months ago

Add an is_large_network check that works on single sites and networks.

#5 @johnjamesjacoby
3 months ago

3.diff is based on 2.diff, but suggests the following alterations:

  • Prefer bp_is_large_install() over bp_is_large_network(). Networks do not have user counts, removing a mild naming inaccuracy. (This also mirrors what's in bbPress.)
  • Use this new function in 1 extra place (inside bp_blogs_record_existing_blogs())
  • Remove the sites vs users designation. BuddyPress will really only ever care about user counts, and has not ever used the sites version of wp_is_large_network(). If it ever does, it will be able to use the core function. If BuddyPress needs a count of the number of sites in a network, it can rely on the WordPress core queries or functions.
  • Only applies the filters once at the end of the function. The WordPress core pattern of having 2 apply_filters() calls that do the same thing inside the same function, is more confusing than it needs to be, and one I'd prefer we not follow in code that is under our influence.

#6 @boonebgorges
3 months ago

  • Component changed from Core to Groups

I agree with @dcavins that we should call our own wrapper. I agree with @johnjamesjacoby that we should disregard sites for most purposes. I'll do some cleanup.

#7 @boonebgorges
3 months ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 12303:

Introduce bp_is_large_install() and use throughout BuddyPress.

This checks provides a fallback that is not dependent on Multisite, and
helps prevent a fatal error introduced in [12241]. See #7980.

Props shanebp, dcavins, johnjamesjacoby.
Fixes #8012.

#8 @boonebgorges
3 months ago

In 12304:

Introduce bp_is_large_install() and use throughout BuddyPress.

This checks provides a fallback that is not dependent on Multisite, and
helps prevent a fatal error introduced in [12241]. See #7980.

Merges [12303] to the 4.0 branch.

Props shanebp, dcavins, johnjamesjacoby.
Fixes #8012.

Note: See TracTickets for help on using tickets.