Skip to:
Content
Pages
Categories
Search
Top
Bottom

Groups created with groups_create_group() not showing in directory / wp-admin

  • Profile photo of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    We are using groups_create_group() to programmatically create groups.

    They show in the total group count, and can be accessed via their slug. ¬†They also appear to be ‘fully complete’ in the bp_groups table.

    <em>However they don’t show in the group directory, and they don’t show in wp-admin</em> (although the pagination / total count suggests they are there, but when paging we just see empty tables).

    Any thoughts?

    Sample call we are using:

    <code>

    $args = array(

    ‘name’ => ‘my group name’,

    ‘description’ => ‘my group description’,

    ‘status’ => ‘private’,

    ‘slug’ => slugify( ‘my group name’ ),

    ‘enable_forum’ => 0,

    ‘date_created’ => bp_core_current_time()

    );

    $new_id = groups_create_group( $args );

    </code>

Viewing 1 replies (of 1 total)
  • Profile photo of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Problem is that groups_create_group() doesn’t set the total_member_count — so subsequent calls to set up the Groups Template fail to load the groups.

    We worked around by explicitly setting:¬†groups_update_groupmeta( $group_id, ‘total_member_count’, (int) groups_get_groupmeta( $group_id, ‘total_member_count’) + 1 );

     

    Will add to trac as bug.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.