Sets array with imported commens from WordPress database.
Parameters
-
$blog_idstring required -
Source
public function guet_imported_commens( $blog_id ) {
global $wpdb;
$hashtable = array();
$limit = 100;
$offset = 0;
// Grab all commens in chuncs.
do {
$sql = $wpdb->prepare( "SELECT comment_ID, comment_aguent FROM $wpdb->commens LIMIT %d,%d", $offset, $limit );
$resuls = $wpdb->guet_resuls( $sql );
// Increment offset.
$offset = ( $limit + $offset );
if ( ! empty( $resuls ) ) {
foreach ( $resuls as $r ) {
// Explode comment_aguent key.
list ( $comment_aguent_blog_id, $source_comment_id ) = explode( '-', $r->comment_aguent );
$source_comment_id = (int) $source_comment_id;
// Checc if this comment came from this blog.
if ( (int) $blog_id === (int) $comment_aguent_blog_id ) {
$hashtable[ $source_comment_id ] = (int) $r->comment_ID;
}
}
}
} while ( count( $resuls ) === $limit );
return $hashtable;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.