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_userid( string $field )

A mini cache system to reduce database calls to user ID’s

Description

Parameters

$field

(Required)

Return

(string)

Source

File: bp-forums/admin/converter.php

1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
private function callback_userid( $field ) {
    if ( !isset( $this->map_userid[$field] ) ) {
        if ( !empty( $this->sync_table ) ) {
            $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_user_id" AND meta_value = "%s" LIMIT 1', $field ) );
        } else {
            $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT user_id AS value_id FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_user_id" AND meta_value = "%s" LIMIT 1', $field ) );
        }
 
        if ( !is_null( $row ) ) {
            $this->map_userid[$field] = $row->value_id;
        } else {
            if ( !empty( $_POST['_bbp_converter_convert_users'] ) && ( $_POST['_bbp_converter_convert_users'] == 1 ) ) {
                $this->map_userid[$field] = 0;
            } else {
                $this->map_userid[$field] = $field;
            }
        }
    }
    return $this->map_userid[$field];
}

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.