BP_REST_Forums_Endpoint::bp_rest_get_group( int $forum_id )

Get Forum’s group.

Description

Parameters

$forum_id

(Required) ID of the forum.

Return

(BP_Groups_Group|string)

Source

File: bp-forums/classes/class-bp-rest-forums-endpoint.php

1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
public function bp_rest_get_group( $forum_id ) {
    if ( empty( $forum_id ) ) {
        return '';
    }
 
    if ( bbp_get_forum_group_ids( $forum_id ) ) {
        $group              = groups_get_group( current( bbp_get_forum_group_ids( $forum_id ) ) );
        $group->avatar_urls = array();
        if ( ! bp_disable_group_avatar_uploads() ) {
            $group->avatar_urls = array(
                'thumb' => bp_core_fetch_avatar(
                    array(
                        'html'    => false,
                        'object'  => 'group',
                        'item_id' => $group->id,
                        'type'    => 'thumb',
                    )
                ),
                'full'  => bp_core_fetch_avatar(
                    array(
                        'html'    => false,
                        'object'  => 'group',
                        'item_id' => $group->id,
                        'type'    => 'full',
                    )
                ),
            );
        }
 
        return $group;
    }
 
    return '';
 
}

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.