function bp_portfolio_has_items($args = array()) { global $bp, $items_template; $user_id = 0; if (!empty($bp->displayed_user->id)) { $user_id = $bp->displayed_user->id; } // This keeps us from firing the query more than once if (empty($items_template)) { $default = array('id' => 0, 'author_id' => $user_id, 'title' => null, 'description' => null, 'url' => null, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s'), 'tags' => array(), 'posts_per_page' => 10, 'page' => 1, 'search_terms' => null); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); $items_template = new BP_Portfolio_Item(); $items_template->get($r); } return $items_template->have_posts(); }