Skip to:

Opened 6 years ago

Closed 6 years ago

#7837 closed defect (bug) (fixed)

Group Detail Pages Not Showing w/ Custom Meta Plug-Ins in Version 3.0.0

Reported by: gcmaryland's profile gcmaryland Owned by: r-a-y's profile r-a-y
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.0.0
Component: Templates Keywords: needs-patch


Group detail pages not showing up following 3.0.0 update on several sites. Rolling back BP to 2.9.4 fixes issues in both the previous and current versions of WP. It appears to be linked to sites currently using custom group meta through an active or inactive plug-ins. I’ve noticed that removing the line: add_filter( ‘groups_custom_group_fields_editable’, ‘group_header_fields_markup’ ); from active plug-ins using the group meta template ( breaks the plug-in and allows the group pages to be loaded correctly. Also, I’ve noticed that all of these functions have the $wpdb object referenced in ( Perhaps there’s a connection? Otherwise, it still appears to be limited to existing sites using custom group meta plug-ins. I've attached a hastily scribbled checker plug-in to test our sites:

[ Also, first Trac issue, so please be kind. :) ]

Plugin Name: Sample Compatibility Checker
Description: Verify meta data plug-in compatability with BP 3.0.0
Version: 0.1
Requires at least: 3.3
Tested up to: 4.8.1
Author: null
Author URI: https://null

//////////////////// BuddyPress Group Meta Management:
function bp_group_meta_init_checker() {
function custom_field_checker($meta_key='') {

//get current group id and load meta_key value if passed. If not pass it blank
return groups_get_groupmeta( bp_get_group_id(), $meta_key) ;

// This function is our custom field's form that is called in create a group and when editing group details
function group_header_fields_markup_checker() {
global $bp, $wpdb;
//////////////////// End BuddyPress Group Meta Management

//////////////////// Front-End Output

<div style="padding: 20px; margin-top: 10px; margin-bottom: 20px;">
	<b style="font-size: 150%;">Sample Compatibility Checker</b>
	<p>Use these features to categorize your group on MyGC.</p>
		<label for="checker_thing">Thing</label>
			<select name="checker_thing">
				<option value="<?php echo custom_field('checker_thing'); ?>"><?php echo custom_field('checker_thing'); ?></option>
				<option value="Something">Something</option>
				<option value="Not Something">Not Something</option>
//////////////////// End Front-End Output

//////////////////// Insert Group Meta
// This saves the custom group meta ... props to Boone for the function!
// Where $plain_fields = array.. you may add additional fields, eg
//  $plain_fields = array(
//      'field-one',
//      'field-two'
//  );
function group_header_fields_save_checker( $group_id ) {
	global $bp, $wpdb;
	$plain_fields = array(

	foreach( $plain_fields as $field ) {
		$key = $field;
		if ( isset( $_POST[$key] ) ) {
			$value = $_POST[$key];
			groups_update_groupmeta( $group_id, $field, $value );


add_filter( 'groups_custom_group_fields_editable', 'group_header_fields_markup_checker' );
add_action( 'groups_group_details_edited', 'group_header_fields_save_checker' );
add_action( 'groups_created_group',  'group_header_fields_save_checker' );
//////////////////// Insert Group Meta


add_action( 'bp_include', 'bp_group_meta_init_checker' );

Attachments (2)

7837.01.patch (880 bytes) - added by r-a-y 6 years ago.
7837.02.patch (2.0 KB) - added by r-a-y 6 years ago.

Download all attachments as: .zip

Change History (19)

#2 @r-a-y
6 years ago

  • Component changed from Groups to Templates
  • Milestone changed from Awaiting Review to 3.0.1
  • Owner set to r-a-y
  • Status changed from new to reviewing
  • Version set to 3.0.0

Duplicated the problem with bp-nouveau. bp-legacy works fine.

Here's my test code:

// Add a custom field to the group creation process and on a group's "Manage > Details" page.
add_action( 'groups_custom_group_fields_editable', function() {
        if ( bp_get_current_group_id() ) {
                $todo = groups_get_groupmeta( bp_get_current_group_id(), 'my_group_todo' );
        } else {
                $todo = '';

        $todo = esc_textarea( $todo );

        $markup = <<<EOD

                <label for="group-todo">Group Todo</label>
                <textarea name="group-todo" id="group-todo" aria-required="true" placeholder="Write whatever you need to do here.">{$todo}</textarea>


        echo $markup;
} );

// Save our custom group meta entry when it is updated.
function my_groupmeta_save() {
        if ( ! isset( $_POST['group-todo'] ) ) {

        // Handles fetching the group ID during the group creation phase.
        if ( 'groups_create_group_step_save_group-details' === current_action() ) {
                $group_id = isset( buddypress()->groups->new_group_id ) ? buddypress()->groups->new_group_id : 0;
        } else {
                $group_id = bp_get_current_group_id();

        if ( $group_id ) {
                groups_update_groupmeta( $group_id, 'my_group_todo', $_POST['group-todo'] );

add_action( 'groups_create_group_step_save_group-details', 'my_groupmeta_save' );
add_action( 'groups_group_details_edited', 'my_groupmeta_save' );

6 years ago

6 years ago

#3 @r-a-y
6 years ago

  • Keywords has-patch added
  • Status changed from reviewing to accepted

The problem is Nouveau is missing the 'groups_custom_group_fields_editable' hook, which quite a few plugins rely on to add their group meta markup.

I have two approaches to fix this.

01.patch is the straightforward approach. 02.patch is structured more within the Nouveau way of doing things, however 02.patch also moves the "Notify members via email" checkbox to the bp_nouveau_group_manage_screen() function. This is due to how the 'groups_custom_group_fields_editable' hook needs to fire before the checkbox to match bp-legacy. However, the bp_nouveau_group_manage_screen() function already contains some markup for nonces and submit button, so maybe this is okay? We could add the checkbox markup to a hook if that is cleaner.

Would like to have some feedback from @hnla and @imath.

#4 @imath
6 years ago

Hi @r-a-y

Thanks a lot for your patches. Adding hooks in templates is very wrong imho. Nouveau was built to avoid this in the first place.

By the way, there used to be a feedback message informing the action was "deprecated" in Nouveau:,L551

So I haven't tested but 02.patch would be the approach I'd advise.

#5 @hnla
6 years ago

Yep there were deprecated 'foresaken' messages, sadly those were removed. Ditto thanks for the detailed patch r-a-y, I'm happy to run with the patch, but can test when I have next spare minutes if we need to.

#6 @DJPaul
6 years ago

General request: when we modify a template pack theme file, please add a new “version” line at the top of the file detailing the change. There should be one sample line at the top of every file already, so hopefully it’ll be obvious enough.

#7 @DJPaul
6 years ago

  • Milestone changed from 3.0.1 to 3.1.0

Milestone renamed

#8 @JanDieckmann
6 years ago


I am thankful and happy that this issue is taken care of so quickly. Now I want to know if I can already use it somehow or if there is already an idea when 3.1.0 will be available? Is it about weeks or months?


#9 @DJPaul
6 years ago

@JanDieckmann Sometime next week. Probably the 5th, if I have to do the release myself again.

#10 @DJPaul
6 years ago

  • Milestone changed from 3.1.0 to 3.2.0

#11 @JanDieckmann
6 years ago

What a pity! Is there an insight into the timetable of the milestones? And anything I can do to influence that the fix of this bug will be available soon? Unfortunately I am not advanced in programming.

#12 @DJPaul
6 years ago

I moved this out of 3.1 because it didn't seem tested enough or agreed-upon yet. I don't know when this release is coming out, we need most of the items in the 3.2 milestone closed to consider a subsequent release because our release process is manual and too painful to do frequently.

#13 @r-a-y
6 years ago

I think my only problem with 02.patch was the move of the "Notify group members of these changes via email" checkbox to bp_nouveau_group_manage_screen(). This means that the only way a developer could remove the checkbox is via CSS, which isn't great.

Perhaps we can either:

  1. Hook the checkbox to the 'groups_custom_group_fields_editable' hook and then developers could remove it if they choose to, or
  2. Introduce a new filter so the checkbox can be toggled off.

#14 @imath
6 years ago


+1 for your suggestion to hook the checkbox to the 'groups_custom_group_fields_editable'

Last edited 6 years ago by imath (previous) (diff)

#15 @DJPaul
6 years ago

  • Milestone changed from 3.2.0 to 4.0

#16 @DJPaul
6 years ago

  • Keywords needs-patch added; has-patch removed

#17 @boonebgorges
6 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 12290:

Nouveau: Fix back compat for plugins adding markup at 'groups_custom_group_fields_editable'.

Props r-a-y, imath.
Fixes #7837.

Note: See TracTickets for help on using tickets.