Skip to:
Content

BuddyPress.org

Changeset 4111


Ignore:
Timestamp:
03/11/2011 08:04:13 PM (15 years ago)
Author:
djpaul
Message:

Fix favourited activity items from hidden groups showing in members' profiles. Fixes #2678 (branch)

Location:
branches/1.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-activity.php

    r4066 r4111  
    611611function bp_activity_get_specific( $args = '' ) {
    612612        $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
    619620        );
    620621
     
    622623        extract( $r, EXTR_SKIP );
    623624
    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 ) );
    625626}
    626627
     
    995996function bp_activity_get_user_favorites( $user_id ) {
    996997        $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 ) );
    998999
    9991000        foreach( (array)$existing_favs['activities'] as $fav )
  • branches/1.2/bp-activity/bp-activity-classes.php

    r3145 r4111  
    167167        }
    168168
    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 ) {
    170170                global $wpdb, $bp;
    171171
     
    184184                        $sort = 'DESC';
    185185
    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}" ) );
    188194
    189195                if ( $display_comments )
  • branches/1.2/bp-activity/bp-activity-templatetags.php

    r3287 r4111  
    3030                // Fetch specific activity items based on ID's
    3131                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 ) );
    3333                // Fetch all activity items
    3434                else
Note: See TracChangeset for help on using the changeset viewer.