I'm currently storing results in a variable from a db table like this :
$followed = $wpdb->get_results("SELECT user_id1 FROM wp_um_followers WHERE user_id2 = 1", ARRAY_A);
This returns an array like this :
Array ( [0] => Array ( [user_id1] => 144 ) [1] => Array ( [user_id1] => 50 ) [2] => Array ( [user_id1] => 42 ) [3] => Array ( [user_id1] => 829 ) [4] => Array ( [user_id1] => 826 ) [5] => Array ( [user_id1] => 822 ) [6] => Array ( [user_id1] => 823 ) [7] => Array ( [user_id1] => 821 ) [8] => Array ( [user_id1] => 820 ) [9] => Array ( [user_id1] => 819 ) [10] => Array ( [user_id1] => 818 ) [11] => Array ( [user_id1] => 816 ) [12] => Array ( [user_id1] => 817 ) [13] => Array ( [user_id1] => 814 ) [14] => Array ( [user_id1] => 815 ) [15] => Array ( [user_id1] => 15 ) [16] => Array ( [user_id1] => 93 ) [17] => Array ( [user_id1] => 844 ) )
Now I'd like to set up a new query using the user_id1 values from the above array as the values for a multiple author query on a custom post type.
Something like this :
$get_these_posts = array( 'post_type' => 'stream', 'post_status' => 'publish', 'posts_per_page' => '10', 'paged' => $paged, ( array( 'author__in' => array( $followed ) ) ) );
Which should return posts only from authors who appear in the original query stored in the $followed variable.
But this isn't working obviously as I'm not targeting the correct part of the array [user_id1] and I don't know how to.
I'm not even sure that the second query is set up right, or if it indeed can be set up in this way at all?
Any help will be greatly appreciated.