Skip to:
Content

BuddyPress.org

Changeset 3985


Ignore:
Timestamp:
02/01/2011 09:47:50 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Allow individual activity stream comments and forum replies to appear in favorites listings

Location:
trunk/bp-activity
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-actions.php

    r3982 r3985  
    1717
    1818    // Not viewing activity
    19     if ( ( $bp->current_component != $bp->activity->id ) || ( $bp->current_action != 'p' ) )
     19    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'p' ) )
    2020        return false;
    2121
     
    6868
    6969    // Not viewing activity or action is not delete
    70     if ( ( $bp->current_component != $bp->activity->id ) || ( $bp->current_action != 'delete' ) )
     70    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'delete' ) )
    7171        return false;
    7272
     
    106106
    107107    // Do not proceed if user is not logged in, not viewing activity, or not posting
    108     if ( !is_user_logged_in() || ( $bp->current_component != $bp->activity->id ) || ( 'post' != $bp->current_action ) )
     108    if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'post' ) )
    109109        return false;
    110110
     
    152152    global $bp;
    153153
    154     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->id || $bp->current_action != 'reply' )
     154    if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'reply' ) )
    155155        return false;
    156156
     
    184184    global $bp;
    185185
    186     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'favorite' )
    187         return false;
    188 
    189     /* Check the nonce */
     186    if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'favorite' ) )
     187        return false;
     188
     189    // Check the nonce
    190190    check_admin_referer( 'mark_favorite' );
    191191
     
    202202    global $bp;
    203203
    204     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
    205         return false;
    206 
    207     /* Check the nonce */
     204    if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'unfavorite' ) )
     205        return false;
     206
     207    // Check the nonce
    208208    check_admin_referer( 'unmark_favorite' );
    209209
     
    220220    global $bp, $wp_query;
    221221
    222     if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || ( isset( $bp->displayed_user->id ) && $bp->displayed_user->id ) || isset( $bp->groups->current_group ) )
     222    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'feed' ) || bp_is_user() || isset( $bp->groups->current_group ) )
    223223        return false;
    224224
     
    234234    global $bp, $wp_query;
    235235
    236     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
     236    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_user() || !bp_is_current_action( 'feed' ) )
    237237        return false;
    238238
     
    248248    global $bp, $wp_query;
    249249
    250     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != $bp->friends->slug || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     250    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_user() || !bp_is_current_action( $bp->friends->slug ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    251251        return false;
    252252
     
    262262    global $bp, $wp_query;
    263263
    264     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != $bp->groups->slug || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     264    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_user() || !bp_is_current_action( $bp->groups->slug ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    265265        return false;
    266266
     
    276276    global $bp, $wp_query;
    277277
    278     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'mentions' || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     278    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_user() || !bp_is_current_action( 'mentions' ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    279279        return false;
    280280
     
    290290    global $bp, $wp_query;
    291291
    292     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'favorites' || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
     292    if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_user() || !bp_is_current_action( 'favorites' ) || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    293293        return false;
    294294
  • trunk/bp-activity/bp-activity-classes.php

    r3917 r3985  
    134134        // comments in the stream like normal comments or threaded below
    135135        // the activity.
    136         if ( !$display_comments || 'threaded' == $display_comments )
     136        if ( false === $display_comments || 'threaded' === $display_comments )
    137137            $where_conditions[] = "a.type != 'activity_comment'";
    138138
  • trunk/bp-activity/bp-activity-functions.php

    r3982 r3985  
    153153
    154154    // Get favorites for user
    155     $favs          = get_user_meta( $user_id, 'bp_favorite_activities', true );
    156     $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $favs ) );
    157 
    158     foreach( (array)$existing_favs['activities'] as $fav )
    159         $new_favs[] = $fav->id;
    160 
    161     $new_favs = array_unique( (array)$new_favs );
    162     update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
    163 
    164     return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
     155    $favs = get_user_meta( $user_id, 'bp_favorite_activities', true );
     156
     157    return apply_filters( 'bp_activity_get_user_favorites', $favs );
    165158}
    166159
     
    550543        'max'              => false,  // Maximum number of results to return
    551544        'sort'             => 'DESC', // sort ASC or DESC
    552         'display_comments' => false   // true or false to display threaded comments for these specific activity items
     545        'display_comments' => false,  // true or false to display threaded comments for these specific activity items
     546        'show_hidden'      => false
    553547    );
    554548    $r = wp_parse_args( $args, $defaults );
    555549    extract( $r, EXTR_SKIP );
    556550
    557     return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids ) );
     551    return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, $show_hidden, false, $activity_ids ) );
    558552}
    559553
  • trunk/bp-activity/bp-activity-template.php

    r3984 r3985  
    9494        // Fetch specific activity items based on ID's
    9595        if ( !empty( $include ) )
    96             $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 ) );
     96            $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 ) );
    9797        // Fetch all activity items
    9898        else
     
    317317                        return false;
    318318
    319                     $include = implode( ',', (array)$favs );
     319                    $include          = implode( ',', (array)$favs );
     320                    $show_hidden      = true;
     321                    $display_comments = true;
    320322                    break;
    321323                case 'mentions':
    322                     $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;
    323                     $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
    324                     $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter.
     324                    $user_nicename    = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;
     325                    $user_login       = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
     326                    $search_terms     = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter.
    325327                    $display_comments = 'stream';
    326328                    $user_id = 0;
Note: See TracChangeset for help on using the changeset viewer.