o.m.g. that was painful – but it works.
Thanks to @chancharles and @pauloasilva
To fix this plugin you would need to edit the file:
../wp-content/plugins/buddypress-group-tags/bp-group-tags.php
Replace from line 21 which should read:
function bp_gtags_setup_globals() {
up to and including lines 44, 45 which should read:
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘groups/index’ ) );
}
with this:
function bp_gtags_setup_globals() {
global $bp;
$bp->options['gtags'] = (object)Array(
'id' => 'gtags',
'slug' => 'tag'
);
}
add_action( 'bp_setup_globals', 'bp_gtags_setup_globals' );
// in order for tags to show as /groups/tag/mytag I am using this function. however it is not optimal because it's not really a sub menu item
function bp_gtags_setup_nav() {
global $bp;
bp_core_new_subnav_item( array( 'name' => ' ', 'slug' => $bp->options['gtags']->slug, 'parent_slug' => BP_GROUPS_SLUG, 'parent_url' => $bp->root_domain .'/'. BP_GROUPS_SLUG . '/', 'screen_function' => 'gtags_display_hook', 'position' => -1 ) );
}
add_action( 'bp_setup_nav', 'bp_gtags_setup_nav', 1000 );
// a hack to remove the group tags menu item before the admin bar is displayed. it works because the admin bar is called last
function gtags_remove_tags_from_admin_bar() {
global $bp;
unset ( $bp->bp_options_nav['groups']['98564'] );
}
function gtags_return_blank() {
return '';
}
add_action( 'bp_adminbar_menus', 'gtags_remove_tags_from_admin_bar', 3 );
function gtags_display_hook() {
add_filter('bp_current_action', 'gtags_return_blank');
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/index' ) );
remove_filter('bp_current_action', 'gtags_return_blank');
}
Then also replace line somewhere around 170 to 180 which reads:
“SELECT meta_value FROM ” . $bp->groups->table_name_groupmeta . ” WHERE meta_key = ‘gtags_group_tags’ ” ) );
with
"SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = %s", 'gtags_group_tags' ) );