Changeset 4111
- Timestamp:
- 03/11/2011 08:04:13 PM (14 years ago)
- Location:
- branches/1.2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-activity.php
r4066 r4111 611 611 function bp_activity_get_specific( $args = '' ) { 612 612 $defaults = array( 613 'activity_ids' => false, // A single activity_id or array of IDs. 614 'page' => 1, // page 1 without a per_page will result in no pagination. 615 'per_page' => false, // results per page 616 'max' => false, // Maximum number of results to return 617 'sort' => 'DESC', // sort ASC or DESC 618 'display_comments' => false // true or false to display threaded comments for these specific activity items 613 'activity_ids' => false, // A single activity_id or array of IDs. 614 'page' => 1, // page 1 without a per_page will result in no pagination. 615 'per_page' => false, // results per page 616 'max' => false, // Maximum number of results to return 617 'sort' => 'DESC', // sort ASC or DESC 618 'display_comments' => false, // true or false to display threaded comments for these specific activity items 619 'show_hidden' => false 619 620 ); 620 621 … … 622 623 extract( $r, EXTR_SKIP ); 623 624 624 return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get_specific( $activity_ids, $max, $page, $per_page, $sort, $display_comments ) );625 return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get_specific( $activity_ids, $max, $page, $per_page, $sort, $display_comments, $show_hidden ) ); 625 626 } 626 627 … … 995 996 function bp_activity_get_user_favorites( $user_id ) { 996 997 $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) ); 997 $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) );998 $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs, 'show_hidden' => true ) ); 998 999 999 1000 foreach( (array)$existing_favs['activities'] as $fav ) -
branches/1.2/bp-activity/bp-activity-classes.php
r3145 r4111 167 167 } 168 168 169 function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {169 function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false, $show_hidden = false ) { 170 170 global $wpdb, $bp; 171 171 … … 184 184 $sort = 'DESC'; 185 185 186 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids}) ORDER BY date_recorded {$sort} $pag_sql" ) ); 187 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids})" ) ); 186 // Hide Hidden Items? 187 if ( !$show_hidden ) 188 $hidden_sql = "AND hide_sitewide = 0"; 189 else 190 $hidden_sql = ''; 191 192 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids}) {$hidden_sql} ORDER BY date_recorded {$sort} {$pag_sql}" ) ); 193 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids}) {$hidden_sql}" ) ); 188 194 189 195 if ( $display_comments ) -
branches/1.2/bp-activity/bp-activity-templatetags.php
r3287 r4111 30 30 // Fetch specific activity items based on ID's 31 31 if ( !empty( $include ) ) 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 ) );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, 'show_hidden' => $show_hidden ) ); 33 33 // Fetch all activity items 34 34 else
Note: See TracChangeset
for help on using the changeset viewer.