Skip to:
Content
Pages
Categories
Search
Top
Bottom

Created groups with plugin not counted in the Group List

  • @doremdou

    Participant

    Hello! 🙂
    I am using a code (see below) to create groups.
    However they are not counted as groups so pages are not displaying correctly in the Group List.
    Created groups with this code are displaying well in the group list BUT as they are not counted as groups, most of them are “in invisible pages”.

    See screenshot:

    I am using this code to create groups (http://danpolant.com/how-to-create-groups-in-buddypress-with-php/ )

    function create_a_group() {
     
        $new_group = new BP_Groups_Group;
     
            $new_group->creator_id = 1;
            $new_group->name = ‘test’;
            $new_group->slug = ‘test’;
            $new_group->description = ‘nothing’;
            $new_group->news = ‘whatever’;
            $new_group->status = ‘public’;
            $new_group->is_invitation_only = 1;
            $new_group->enable_wire = 1;
            $new_group->enable_forum = 1;
            $new_group->enable_photos = 1;
            $new_group->photos_admin_only = 1;
            $new_group->date_created = current_time(‘mysql’);
            $new_group->total_member_count = 1;
            $new_group->avatar_thumb = ‘some kind of path’;
            $new_group->avatar_full = ‘some kind of path’;
     
        $new_group -> save();
        groups_update_groupmeta( $new_group->id, ‘total_member_count’, 1 );
        groups_update_groupmeta( $new_group->id, ‘last_activity’, time() );
        groups_update_groupmeta( $new_group->id, ‘theme’, ‘buddypress’ );
        groups_update_groupmeta( $new_group->id, ‘stylesheet’, ‘buddypress’ );
        groups_update_groupmeta( $new_group->id, ‘invite_status’, ‘members’ );
     
    }

    What is wrong with this code? Does it miss adding a meta somewhere to show up newly created groups in the groups list?
    Thank you very much 🙂
    and sorry for my bad english… :S
    Dor

Viewing 8 replies - 1 through 8 (of 8 total)
  • @doremdou

    Participant

    Hi again,

    any ideas why? ;x
    Thanks

    @modemlooper

    Moderator

    Did you read all comments? It tells how to make group show.

    @doremdou

    Participant

    Hello @modemlooper thank you for your answer 🙂
    Yes I did read all comments and as you can see in my code I added:
    groups_update_groupmeta( $id, ‘invite_status’, ‘members’ );
    (It is the only thing in the comments or did I miss something?)

    All groups are well displayed it is not the problem.

    It is just that they are well counted in the “General Groups Counter” (All groups 140)
    but not counted in the
    Group List Counter” (Viewing group 61 to 80 (of 111 groups))
    as you can see on my screenshot :/

    @doremdou

    Participant

    Hi again, please can someone help?
    Some of my groups are unusable it is really annoying :/
    Thanks

    @doremdou

    Participant

    Hi 🙂
    I still need help for this please, anyone has any advices? a tip? where should I search?
    I am completely lost 🙁

    Thank you 🙂

    @doremdou

    Participant

    Hello everyone 🙂

    after 1 month I still can’t figure this out, please can someone help? 🙁

    Thank you very much in advance.
    Dorem

    @r-a-y

    Keymaster

    The total group count doesn’t do any checks to see if it has any last activity or member count, which is why you see a higher count.

    However, the group loop does do checks for last activity and member count. It’s possible that your created groups do not have any activity in them. Try posting an update in each group and see if it shows up in the group loop.

    Also, try creating group using BP’s native function – groups_create_group():
    https://buddypress.trac.wordpress.org/browser/tags/2.0.1/bp-groups/bp-groups-functions.php#L60

    @doremdou

    Participant

    Hello @r-a-y thank you for your help 🙂
    I tried to post an update in each group but it didnt change anything, auto created groups still don’t show up in the group loop.

    And… sorry but I am very new with php and all, do I need to replace the function in my code (in the first post) with the one you linked?

    Thanks 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Created groups with plugin not counted in the Group List’ is closed to new replies.
Skip to toolbar