[buddypress-trac] [BuddyPress Trac] #7837: Group Detail Pages Not Showing w/ Custom Meta Plug-Ins in Version 3.0.0
buddypress-trac
noreply at wordpress.org
Fri May 18 18:34:51 UTC 2018
#7837: Group Detail Pages Not Showing w/ Custom Meta Plug-Ins in Version 3.0.0
--------------------------+-----------------------------
Reporter: gcmaryland | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Groups | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
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 (https://codex.buddypress.org/plugindev/how-to-edit-group-meta-
tutorial/) 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 (https://buddypress.trac.wordpress.org/ticket/7834).
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. :) ]
{{{
<?php
/*
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:
https://codex.buddypress.org/plugindev/how-to-edit-group-meta-tutorial/
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>
</select>
</div>
<?php
//////////////////// 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(
'checker_thing'
);
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' );
?>
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7837>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list