function bp_wire_posts_template($item_id, $component_slug, $can_post, $per_page, $max) { global $bp; if ($bp->current_component == $bp->wire->slug) { $this->table_name = $bp->profile->table_name_wire; // If the user is viewing their own wire, delete the notifications. if ('all-posts' == $bp->current_action && bp_is_home()) { bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'xprofile', 'new_wire_post'); } } else { $this->table_name = $bp->{$component_slug}->table_name_wire; } $this->pag_page = isset($_REQUEST['wpage']) ? intval($_REQUEST['wpage']) : 1; $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page; $this->wire_posts = BP_Wire_Post::get_all_for_item($item_id, $this->table_name, $this->pag_page, $this->pag_num); $this->total_wire_post_count = (int) $this->wire_posts['count']; $this->wire_posts = $this->wire_posts['wire_posts']; $this->wire_post_count = count($this->wire_posts); if ((int) get_site_option('non-friend-wire-posting') && ($bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug)) { $this->can_post = 1; } else { $this->can_post = $can_post; } $this->pag_links = paginate_links(array('base' => add_query_arg('wpage', '%#%', $bp->displayed_user->domain), 'format' => '', 'total' => ceil($this->total_wire_post_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1)); }