Changeset 3245 for branches/1.2/bp-activity/bp-activity-templatetags.php
- Timestamp:
- 09/10/2010 08:12:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-activity/bp-activity-templatetags.php
r3214 r3245 20 20 21 21 $this->pag_page = isset( $_REQUEST['acpage'] ) ? intval( $_REQUEST['acpage'] ) : $page; 22 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;23 24 / * Check if blog/forum replies are disabled */22 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 23 24 // Check if blog/forum replies are disabled 25 25 $this->disable_blogforum_replies = $bp->site_options['bp-disable-blogforum-comments']; 26 26 27 / * Get an array of the logged in user's favorite activities */27 // Get an array of the logged in user's favorite activities 28 28 $this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) ); 29 29 30 if ( !empty( $include ) ) {31 /* Fetch specific activity items based on ID's */30 // Fetch specific activity items based on ID's 31 if ( !empty( $include ) ) 32 32 $this->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments ) ); 33 } else { 33 // Fetch all activity items 34 else 34 35 $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden ) ); 35 }36 36 37 37 if ( !$max || $max >= (int)$this->activities['total'] ) … … 43 43 44 44 if ( $max ) { 45 if ( $max >= count($this->activities) ) 46 $this->activity_count = count( $this->activities);47 else45 if ( $max >= count($this->activities) ) { 46 $this->activity_count = count( $this->activities ); 47 } else { 48 48 $this->activity_count = (int)$max; 49 } 49 50 } else { 50 $this->activity_count = count( $this->activities);51 $this->activity_count = count( $this->activities ); 51 52 } 52 53 53 54 $this->full_name = $bp->displayed_user->fullname; 54 55 55 / * Fetch parent content for activity comments so we do not have to query in the loop */56 // Fetch parent content for activity comments so we do not have to query in the loop 56 57 foreach ( (array)$this->activities as $activity ) { 57 if ( 'activity_comment' != $activity->type ) continue; 58 if ( 'activity_comment' != $activity->type ) 59 continue; 60 58 61 $parent_ids[] = $activity->item_id; 59 62 } … … 63 66 64 67 if ( !empty( $activity_parents['activities'] ) ) { 65 foreach( $activity_parents['activities'] as $parent ) $this->activity_parents[$parent->id] = $parent; 68 foreach( $activity_parents['activities'] as $parent ) 69 $this->activity_parents[$parent->id] = $parent; 70 66 71 unset( $activity_parents ); 67 72 } 68 73 69 if ( (int) $this->total_activity_count && (int)$this->pag_num ) {74 if ( (int)$this->total_activity_count && (int)$this->pag_num ) { 70 75 $this->pag_links = paginate_links( array( 71 'base' => add_query_arg( 'acpage', '%#%' ),72 'format' => '',73 'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),74 'current' => (int)$this->pag_page,76 'base' => add_query_arg( 'acpage', '%#%' ), 77 'format' => '', 78 'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ), 79 'current' => (int)$this->pag_page, 75 80 'prev_text' => '←', 76 81 'next_text' => '→', 77 'mid_size' => 178 ) );82 'mid_size' => 1 83 ) ); 79 84 } 80 85 }
Note: See TracChangeset
for help on using the changeset viewer.