>
@
$author_id,
'count' => true,
'status' => 'approve',
)
);
?>
$author_id,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'fields' => 'ids',
'no_found_rows' => true,
'meta_query' => array(
'relation' => 'OR',
array( 'key' => '_blurt_repost_of', 'compare' => 'EXISTS' ),
array( 'key' => '_blurt_repost_of_comment', 'compare' => 'EXISTS' ),
),
)
) )->post_count;
$media_count = (int) ( new WP_Query(
array(
'author' => $author_id,
'post_type' => 'attachment',
'post_status' => 'inherit',
'post_mime_type' => array( 'image', 'video' ),
'posts_per_page' => -1,
'fields' => 'ids',
'no_found_rows' => true,
)
) )->post_count;
$like_count = 0;
if ( class_exists( 'Likes' ) ) {
$blog_id = get_current_blog_id();
$likes_data = Likes::get_likes( $author_id, $blog_id, array( 'per_page' => 1, 'page' => 1 ) );
if ( is_array( $likes_data ) && isset( $likes_data['total'] ) ) {
$like_count = (int) $likes_data['total'];
}
}
?>
__( 'Posts', 'blurt' ),
'reposts' => __( 'Reposts', 'blurt' ),
'comments' => __( 'Comments', 'blurt' ),
'media' => __( 'Media', 'blurt' ),
'likes' => __( 'Likes', 'blurt' ),
);
if ( ! isset( $blurt_tabs[ $blurt_tab ] ) ) {
$blurt_tab = 'posts';
}
?>
$author_id,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 20,
'paged' => max( 1, get_query_var( 'paged' ) ),
'meta_query' => array(
'relation' => 'OR',
array(
'key' => '_blurt_repost_of',
'compare' => 'EXISTS',
),
array(
'key' => '_blurt_repost_of_comment',
'compare' => 'EXISTS',
),
),
)
);
if ( $blurt_reposts_query->have_posts() ) :
?>
have_posts() ) :
$blurt_reposts_query->the_post();
echo blurt_render_post_card( get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endwhile;
wp_reset_postdata();
?>
max_num_pages > max( 1, get_query_var( 'paged' ) ) ) : ?>
$author_id,
'status' => 'approve',
'number' => $blurt_per_page,
'offset' => ( $blurt_paged - 1 ) * $blurt_per_page,
'orderby' => 'comment_date',
'order' => 'DESC',
)
);
if ( $blurt_comments ) :
?>
comment_post_ID );
$blurt_comment_like = blurt_get_comment_like_data( $blurt_comment->comment_ID, $blurt_comment->comment_post_ID );
$blurt_comment_img_id = blurt_get_comment_image( $blurt_comment->comment_ID );
?>
$author_id,
'status' => 'approve',
'count' => true,
)
);
if ( $blurt_paged * $blurt_per_page < $blurt_total_comments ) :
?>
get_col(
$wpdb->prepare(
"SELECT DISTINCT p.ID FROM {$wpdb->posts} p
INNER JOIN {$wpdb->posts} a ON a.post_parent = p.ID AND a.post_type = 'attachment' AND a.post_mime_type LIKE %s
WHERE p.post_type = 'post' AND p.post_status = 'publish' AND p.post_author = %d
ORDER BY p.post_date DESC
LIMIT %d OFFSET %d",
'image/%',
$author_id,
$blurt_per_page,
$blurt_offset
)
);
// Also include posts with video attachments.
$blurt_video_post_ids = $wpdb->get_col(
$wpdb->prepare(
"SELECT DISTINCT p.ID FROM {$wpdb->posts} p
INNER JOIN {$wpdb->posts} a ON a.post_parent = p.ID AND a.post_type = 'attachment' AND a.post_mime_type LIKE %s
WHERE p.post_type = 'post' AND p.post_status = 'publish' AND p.post_author = %d
ORDER BY p.post_date DESC
LIMIT %d",
'video/%',
$author_id,
$blurt_per_page
)
);
$blurt_all_media_ids = array_unique( array_merge( $blurt_media_post_ids, $blurt_video_post_ids ) );
$blurt_media_posts = array();
if ( $blurt_all_media_ids ) {
$blurt_media_query = new WP_Query(
array(
'post__in' => $blurt_all_media_ids,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $blurt_per_page,
'orderby' => 'date',
'order' => 'DESC',
)
);
if ( $blurt_media_query->have_posts() ) {
while ( $blurt_media_query->have_posts() ) {
$blurt_media_query->the_post();
$blurt_media_posts[] = get_post();
}
wp_reset_postdata();
}
}
if ( $blurt_media_posts ) :
?>
ID ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endforeach;
?>
40,
'page' => 1,
)
);
if ( is_array( $likes_data ) && ! empty( $likes_data['likes'] ) ) {
foreach ( $likes_data['likes'] as $like_obj ) {
if ( isset( $like_obj->post_id ) ) {
$blurt_liked_post_ids[] = (int) $like_obj->post_id;
} elseif ( is_array( $like_obj ) && isset( $like_obj['post_id'] ) ) {
$blurt_liked_post_ids[] = (int) $like_obj['post_id'];
}
}
}
}
if ( $blurt_liked_post_ids ) :
$blurt_likes_query = new WP_Query(
array(
'post__in' => $blurt_liked_post_ids,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 40,
'orderby' => 'post__in',
)
);
if ( $blurt_likes_query->have_posts() ) :
?>
have_posts() ) :
$blurt_likes_query->the_post();
echo blurt_render_post_card( get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endwhile;
wp_reset_postdata();
?>