Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_groups_get_group_types return empty array


  • d8vjork
    Participant

    @d8vjork

    I try to setting up some Group Types with bp_groups_register_group_type but I cant see the metabox.

    And try to show the array data of bp_groups_get_group_types but it return empty array.

    Maybe an issue of 2.6 release?

Viewing 4 replies - 1 through 4 (of 4 total)

  • r-a-y
    Keymaster

    @r-a-y

    Did you follow the code example from the codex?

    Group Types

    If not, can you paste your code?


    d8vjork
    Participant

    @d8vjork

    Yes, of course. I add this code on theme functions.php file:

    function bp_add_group_types() {
    
        bp_groups_register_group_type( 'radio', array(
            'labels' => array(
                'name' => 'Radios',
                'singular_name' => 'Radio'
            )
        ) );
    
    	bp_groups_register_group_type( 'community', array(
            'labels' => array(
                'name' => 'Comunidades',
                'singular_name' => 'Comunidad'
            )
        ) );
        bp_groups_register_group_type( 'team', array(
            'labels' => array(
                'name' => 'Equipos',
                'singular_name' => 'Equipo'
            )
        ) );
    }
    add_action( 'bp_groups_register_group_types', 'bp_add_group_types' );

    r-a-y
    Keymaster

    @r-a-y

    Looks like the code example doesn’t work in your theme’s functions.php unless you change the hook from 'bp_groups_register_group_types' to 'bp_init'.

    However, the code example from the codex works as-is if used in wp-content/plugins/bp-custom.php.

    Going to file a bug report. Thanks for testing, @d8vjork!

    Update: Here’s the ticket – https://buddypress.trac.wordpress.org/ticket/7138


    d8vjork
    Participant

    @d8vjork

    Now works fine. Thanks r-a-y.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar