Group Types Not Showing Up
-
BuddyPress Create Group Types: V1.0.2
Buddy Press: V2.8.2
BuddyBoss Social Marketplace which uses OneSocial Theme (with child)I’ve verified that the following will show Teams in group add and edit.
/** * Test BuddyPress Group Types */ function my_bp_custom_group_types() { bp_groups_register_group_type( 'team', array( 'labels' => array( 'name' => 'Teams', 'singular_name' => 'Team' ), // New parameters as of BP 2.7. 'has_directory' => 'teams', 'show_in_create_screen' => true, 'show_in_list' => true, 'description' => 'Teams are good', 'create_screen_checked' => true ) ); } add_action( 'bp_groups_register_group_types', 'my_bp_custom_group_types' );In WP Admin/Group/Group Types, I’ve added and can see all my group types. However, none of these group types will show up in group add or edit.
I’ve added echo statements to try to debug:
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly //Class to define custom functions needed if( !class_exists( 'BPGT_Hooks' ) ) { class BPGT_Hooks{ //Constructor function __construct() { add_action( 'bp_groups_register_group_types', array( $this, 'bpgt_register_group_types' ) ); <strong>echo "<p>bpgt-hooks.php::function __construct()</p>";</strong> } //Actions performed for registering custom group types function bpgt_register_group_types() { <strong>echo "<p>bpgt-hooks.php::function bpgt_register_group_types()</p>";</strong> $saved_group_types = get_option( 'bpgt_group_types' ); $group_types = bp_groups_get_group_types(); if( $saved_group_types ) { foreach ($saved_group_types as $key => $saved_group_type) { <strong>echo "saved_group_type = " . $saved_group_type;</strong> $slug = $saved_group_type['slug']; $name = $saved_group_type['name']; $desc = $saved_group_type['desc']; if( !in_array( $slug, $group_types ) ) { $temp = array( 'labels' => array( 'name' => $name, 'singular_name' => $name, ), 'has_directory' => $slug, 'show_in_create_screen' => true, 'show_in_list' => true, 'description' => $desc, 'create_screen_checked' => true ); bp_groups_register_group_type( $name, $temp ); } } } } } new BPGT_Hooks(); }I see the first echo output, but not the second or third.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Group Types Not Showing Up’ is closed to new replies.