Ejemplo n.º 1
0
 /**
  * When on a global directory, get terms for the tag cloud
  *
  * @since 1.4
  */
 public function get_item_terms($terms)
 {
     global $wpdb, $bp;
     // Only on global directory and mygroups view
     if (!bp_docs_is_global_directory() && !bp_docs_is_mygroups_directory()) {
         return $terms;
     }
     // Get list of docs the user has access to
     $item_ids = bp_docs_get_doc_ids_accessible_to_current_user();
     // Pass to wp_get_object_terms()
     $terms = wp_get_object_terms($item_ids, array($bp->bp_docs->docs_tag_tax_name));
     // Reformat
     $terms_array = array();
     foreach ($terms as $t) {
         $terms_array[$t->slug] = array('count' => $t->count, 'name' => $t->name);
     }
     unset($item_ids, $terms);
     return $terms_array;
 }
Ejemplo n.º 2
0
 public function get_docs_with_attachments()
 {
     $atts = get_posts(array('update_meta_cache' => false, 'update_term_cache' => false, 'post_type' => 'attachment', 'post_parent__in' => bp_docs_get_doc_ids_accessible_to_current_user(), 'posts_per_page' => -1));
     return array_unique(wp_list_pluck($atts, 'post_parent'));
 }