Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'streamtube/core/widget/posts/query_args', function( $query_args, $instance ){
- $current_logged_in_user = get_current_user_id();
- if( ! function_exists( 'wpuf_is_following' ) ){
- return $query_args;
- }
- $query_args = wp_parse_args( $query_args, array(
- 'author__in' => array()
- ) );
- if( array_key_exists( 'current_logged_in_following', $instance ) ){
- if( ! $query_args['author__in'] ){
- return $query_args;
- }
- for ( $i = 0; $i < count( $query_args['author__in'] ) ; $i++) {
- if( ! wpuf_is_following( $query_args['author__in'][$i], $current_logged_in_user ) ){
- unset( $query_args['author__in'][$i] );
- }
- }
- $query_args['author__in'] = array_values( $query_args['author__in'] );
- if( ! $query_args['author__in'] ){
- $query_args['nothing'] = true;
- }
- }
- return $query_args;
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement