BP_Groups_Member::populate()

Populate the object’s properties.

Description

Source

File: bp-groups/classes/class-bp-groups-member.php

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
public function populate() {
    global $wpdb;
 
    $bp = buddypress();
 
    if ( $this->user_id && $this->group_id && !$this->id )
        $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
 
    if ( !empty( $this->id ) )
        $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE id = %d", $this->id );
 
    $member = $wpdb->get_row($sql);
 
    if ( !empty( $member ) ) {
        $this->id            = (int) $member->id;
        $this->group_id      = (int) $member->group_id;
        $this->user_id       = (int) $member->user_id;
        $this->inviter_id    = (int) $member->inviter_id;
        $this->is_admin      = (int) $member->is_admin;
        $this->is_mod        = (int) $member->is_mod;
        $this->is_banned     = (int) $member->is_banned;
        $this->user_title    = $member->user_title;
        $this->date_modified = $member->date_modified;
        $this->is_confirmed  = (int) $member->is_confirmed;
        $this->comments      = $member->comments;
        $this->invite_sent   = (int) $member->invite_sent;
    }
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.