Changeset 1376
- Timestamp:
- 04/22/2009 10:34:05 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/buddypress-member/wire/post-list.php
r1366 r1376 3 3 4 4 <form name="wire-post-list-form" id="wire-post-list-form" action="" method="post"> 5 <?php if ( bp_has_wire_posts( bp_wire_item_id(),bp_wire_can_post() ) ) : ?>5 <?php if ( bp_has_wire_posts( 'item_id=' . bp_wire_item_id() . '&can_post=' . bp_wire_can_post() ) ) : ?> 6 6 7 7 <?php if ( bp_wire_needs_pagination() ) : ?> -
trunk/bp-wire/bp-wire-templatetags.php
r1366 r1376 18 18 var $table_name; 19 19 20 function bp_wire_posts_template( $item_id, $can_post ) {20 function bp_wire_posts_template( $item_id, $can_post, $per_page, $max ) { 21 21 global $bp; 22 22 … … 24 24 $this->table_name = $bp->profile->table_name_wire; 25 25 26 // Seeing as we're viewing a users wire, lets remove any new wire 27 // post notifications 28 if ( 'all-posts' == $bp->current_action ) 26 // If the user is viewing their own wire, delete the notifications. 27 if ( 'all-posts' == $bp->current_action && bp_is_home() ) 29 28 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'xprofile', 'new_wire_post' ); 30 29 … … 34 33 35 34 $this->pag_page = isset( $_REQUEST['wpage'] ) ? intval( $_REQUEST['wpage'] ) : 1; 36 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 5;35 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 37 36 38 37 $this->wire_posts = BP_Wire_Post::get_all_for_item( $item_id, $this->table_name, $this->pag_page, $this->pag_num ); … … 104 103 } 105 104 106 function bp_has_wire_posts( $ item_id = null, $can_post = true) {105 function bp_has_wire_posts( $args = '' ) { 107 106 global $wire_posts_template, $bp; 107 108 $defaults = array( 109 'item_id' => false, 110 'can_post' => true, 111 'per_page' => 5, 112 'max' => false 113 ); 114 115 $r = wp_parse_args( $args, $defaults ); 116 extract( $r, EXTR_SKIP ); 108 117 109 118 if ( !$item_id ) 110 119 return false; 111 120 112 $wire_posts_template = new BP_Wire_Posts_Template( $item_id, $can_post );121 $wire_posts_template = new BP_Wire_Posts_Template( $item_id, $can_post, $per_page, $max ); 113 122 return $wire_posts_template->has_wire_posts(); 114 123 } … … 209 218 210 219 $from_num = intval( ( $wire_posts_template->pag_page - 1 ) * $wire_posts_template->pag_num ) + 1; 211 $to_num = ( $from_num + 4 > $wire_posts_template->total_wire_post_count ) ? $wire_posts_template->total_wire_post_count : $from_num + 4;220 $to_num = ( $from_num + ( $wire_posts_template->pag_num - 1) > $wire_posts_template->total_wire_post_count ) ? $wire_posts_template->total_wire_post_count : $from_num + ( $wire_posts_template->pag_num - 1); 212 221 213 222 echo apply_filters( 'bp_wire_pagination_count', sprintf( __( 'Viewing post %d to %d (%d total posts)', 'buddypress' ), $from_num, $to_num, $wire_posts_template->total_wire_post_count ) );
Note: See TracChangeset
for help on using the changeset viewer.