Answers_Query::get_ids()
Description #
Utility method to get all the ids in this request
Source #
File: includes/answer-loop.php
public function get_ids() { if ( $this->ap_ids ) { return; } $this->ap_ids = array( 'post_ids' => array(), 'attach_ids' => array(), 'user_ids' => array(), ); foreach ( (array) $this->posts as $_post ) { $this->ap_ids['post_ids'][] = $_post->ID; $this->ap_ids['attach_ids'] = array_filter( array_merge( explode( ',', $_post->attach ), $this->ap_ids['attach_ids'] ) ); if ( ! empty( $_post->post_author ) ) { $this->ap_ids['user_ids'][] = $_post->post_author; } // Add activities user_id to array. if ( ! empty( $_post->activities ) && ! empty( $_post->activities['user_id'] ) ) { $this->ap_ids['user_ids'][] = $_post->activities['user_id']; } } // Unique ids only. foreach ( (array) $this->ap_ids as $k => $ids ) { $this->ap_ids[ $k ] = array_unique( $ids ); } }
Expand full source code Collapse full source code View on GitHub: includes/answer-loop.php:189
Add your comment