BBP_Converter_Base::convert_reply_to_parents( $start )

This method converts old reply_to post id to new Forums reply_to post id.

Description

Source

File: bp-forums/admin/converter.php

1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
public function convert_reply_to_parents( $start ) {
 
    $has_update = false;
 
    if ( !empty( $this->sync_table ) ) {
        $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_reply_to" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;
    } else {
        $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_reply_to" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;
    }
 
    update_option( '_bbp_converter_query', $query );
 
    $reply_to_array = $this->wpdb->get_results( $query );
 
    foreach ( (array) $reply_to_array as $row ) {
        $reply_to = $this->callback_reply_to( $row->meta_value );
        $this->wpdb->query( 'UPDATE ' . $this->wpdb->postmeta . ' SET meta_value = "' . $reply_to . '" WHERE meta_key = "_bbp_reply_to" AND post_id = "' . $row->value_id . '" LIMIT 1' );
        $has_update = true;
    }
 
    return ! $has_update;
}

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.