bp_core_get_all_posts_for_user( int $user_id )

Fetch every post that is authored by the given user for the current blog.

Description

No longer used in BuddyPress.

Parameters

$user_id

(Required) ID of the user being queried.

Return

(array) Post IDs.

Source

File: bp-members/bp-members-functions.php

function bp_core_get_all_posts_for_user( $user_id = 0 ) {
	global $wpdb;

	if ( empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	return apply_filters( 'bp_core_get_all_posts_for_user', $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) ) );
}

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.