Skip to:
Content
Pages
Categories
Search
Top
Bottom

Open members list in group page

  • Avatar of yu
    yu
    Participant

    @gerbilo

    I want to make members list of a group open for everybody. How should i do that?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Avatar of yu
    yu
    Participant

    @gerbilo

    okey.. i got it:

    in bp-groups/bp-groups-clases i’ve changed this function -

    function get_random_members() {

    $total_randoms = ( $this->total_member_count > 100 ) ? 100 : $this->total_member_count;

    for ( $i = 0; $i < $total_randoms; $i++ ) {

    if ( !(int)$this->user_dataset[$i]->is_banned )

    $users[] = new BP_Groups_Member( $this->user_dataset[$i]->user_id, $this->id );

    }

    return $users;

    }

    Avatar of yu
    yu
    Participant

    @gerbilo

    now i got same problem as recent_blog_posts duplicate thing

    http://tf2.lv/groups/blured/members – note that some members are in the list twice!

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    You want to do what? I don’t understand. You want a list of all members for a specific group. Right?

    Avatar of yu
    yu
    Participant

    @gerbilo

    i want a list of all members in all groups for ALL users (registered/non registered). i’ve done corrections an make this.

    you can see that here – http://tf2.lv/groups/blured/

    but also you can see users duplicates in many groups. my question is why that? and what should i implement now to fix this?

    Avatar of yu
    yu
    Participant

    @gerbilo

    anyone? oO

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    “i want a list of all members in all groups for ALL users (registered/non registered).”

    How does anyone list non-registered users?

    I took a look at the link you gave. Yes there are duplicate users. What code are you using to generate this? It would help if you posted that.

    Avatar of yu
    yu
    Participant

    @gerbilo

    “i want a list of all members in all groups for ALL users (registered/non registered).” – i mean everybody should get a list of group members in group home. whenever group is public or private. as you can see that’s allready done. i’ve just update two numbers in function get_random_members() in bp-groups/bp-groups-clases. that’s all i had done.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    If I were gonna do what you want to do I’d do something like this:

    // group_id, limit, page, exclude_admins_mods, exclude_banned
    $group = BP_Groups_Member::get_all_for_group( $group_id, false, false, false, false ) {
    if ( $group['members'] ) {
    foreach ( (array) $group['members']['user_id'] as $member ) {
    $user= new BP_Core_User($member);
    // do some formatting and display of this user obj
    // see: bp-core-classes.php, 'class BP_Core_User' for what's available

    // $user->avatar_thumb is html link to avatar
    // $user->user_link is html link to user full name
    }
    }

    I’m kinda hazy about the returned array from get_all_for_group(). It looks like it returns an array structured like this:

    array( ‘members’ => $members, ‘count’ => $total_member_count )

    Which means we need the $groups and it is actually composed of:

    array( ‘user_id’, ‘date_modified’)

    Which means we need:

    $group['members']['user_id'] (syntax?)

    As the foreach loop array.

    (sigh) Gotta be a better way but I don’t see any. I have no place to test this easily at the moment.

    Avatar of yu
    yu
    Participant

    @gerbilo

    thnx, i’ll check it!

    but problem is in the default function get_random_members() (or in some NOT DISTINCT sql that is behind this function). so everyone who are using BP will get this strange duplicates of members in member list.

    maybe you could check existing functionality that doesn’t work properly?

    Avatar of yu
    yu
    Participant

    @gerbilo

    we got it!

    in bp-groups-clases.php change

    function get_user_dataset() {
    global $wpdb, $bp;
    return $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT user_id, is_admin, inviter_id, user_title, is_mod FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) );
    }

    to this ->

    function get_user_dataset() {
    global $wpdb, $bp;
    return $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT user_id, is_admin, user_title, is_mod FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) );}

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

You must be logged in to reply to this topic.