This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

BBP_Converter_Base::callback_topicid_to_forumid( string $field )

A mini cache system to reduce database calls map topics ID’s to forum ID’s

Description

Parameters

$field

(Required)

Return

(string)

Source

File: bp-forums/admin/converter.php

1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
private function callback_topicid_to_forumid( $field ) {
    $topicid = $this->callback_topicid( $field );
    if ( empty( $topicid ) ) {
        $this->map_topicid_to_forumid[$topicid] = 0;
    } elseif ( ! isset( $this->map_topicid_to_forumid[$topicid] ) ) {
        $row = $this->wpdb->get_row( 'SELECT post_parent FROM ' . $this->wpdb->posts . ' WHERE ID = "' . $topicid . '" LIMIT 1' );
 
        if ( !is_null( $row ) ) {
            $this->map_topicid_to_forumid[$topicid] = $row->post_parent;
        } else {
            $this->map_topicid_to_forumid[$topicid] = 0;
        }
    }
 
    return $this->map_topicid_to_forumid[$topicid];
}

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.