Retrieve the post SQL based on capability, author, and type.

Signature

get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false )
post_type
 (string) Post type.
full
 (boolean) Optional. Returns a full WHERE statement instead of just an 'andalso' term. Default true.
Default: true
post_author
 (int) Optional. Query posts having a single author ID. Default null.
Default: null
public_only
 (boolean) Optional. Only return public posts. Skips cap checks for $current_user. Default false.
Default: false

Return

(string) SQL WHERE code that can be added to a query.

Source

function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) {
	global $wpdb;

	// Private posts.
	$post_type_obj = get_post_type_object( $post_type );
	if ( ! $post_type_obj )
		return $full ? 'WHERE 1 = 0' : ' 1 = 0 ';

	/**
	 * Filter the capability to read private posts for a custom post type
	 * when generating SQL for getting posts by author.
	 *
	 * @since 2.2.0
	 * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless".
	 *
	 * @param string $cap Capability.
	 */
	if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) {
		$cap = $post_type_obj->cap->read_private_posts;
	}
33 more lines...
WP Trac GitHub

Link here