bp_update_to_1_4_3()

Fix forums media showing in users profile media tab.

Description

Source

File: bp-core/bp-core-update.php

637
638
639
640
641
642
643
644
645
646
647
648
649
function bp_update_to_1_4_3() {
    global $wpdb;
    $bp = buddypress();
    $squery = "SELECT GROUP_CONCAT( pm.meta_value ) as media_id FROM {$wpdb->posts} p, {$wpdb->postmeta} pm WHERE p.ID = pm.post_id and p.post_type in ( 'forum', 'topic', 'reply' ) and pm.meta_key = 'bp_media_ids' and pm.meta_value != ''";
    $records = $wpdb->get_col( $squery );
    if ( ! empty( $records ) && bp_is_active( 'media' ) ) {
        $records = reset( $records );
        if ( !empty( $records ) ) {
            $update_query = "UPDATE {$bp->media->table_name} SET `privacy`= 'forums' WHERE id in (" . $records . ")";
            $wpdb->query( $update_query );
        }
    }
}

Changelog

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