BP_Media::get_activity_attachment_id( integer $activity_id )

Get media attachment id for the activity.

Description

Parameters

$activity_id

(Required) Activity ID

Return

(integer|bool)

Source

File: bp-media/classes/class-bp-media.php

1183
1184
1185
1186
1187
1188
1189
1190
1191
public static function get_activity_attachment_id( $activity_id = 0 ) {
    global $bp, $wpdb;
 
    if ( empty( $activity_id ) ) {
        return false;
    }
 
    return (int) $wpdb->get_var( "SELECT DISTINCT m.attachment_id FROM {$bp->media->table_name} m WHERE m.activity_id = {$activity_id}" );
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.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.