Skip to:
Content

BuddyPress.org

Changeset 3580


Ignore:
Timestamp:
12/24/2010 07:25:05 PM (14 years ago)
Author:
djpaul
Message:

Consolidate BP_Activity_Activity::get_specific/::get methods. Fixes #2970, reverts a part of r 3566 and fixes a PHP notice.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r3519 r3580  
    261261    /* Redirect based on the type of activity */
    262262    if ( $activity->component == $bp->groups->id ) {
    263         if ( $activity->user_id )
     263        if ( $activity->user_id ) {
    264264            $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/';
    265         else {
     265        } else {
    266266            if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) )
    267267                $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/';
     
    652652    extract( $r, EXTR_SKIP );
    653653
    654     return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get_specific( $activity_ids, $max, $page, $per_page, $sort, $display_comments ) );
     654    return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids ) );
    655655}
    656656
  • trunk/bp-activity/bp-activity-classes.php

    r3480 r3580  
    121121        if ( $exclude )
    122122            $where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
    123        
     123
    124124        // The specific ids to which you want to limit the query
    125125        if ( !empty( $in ) ) {
     
    181181    }
    182182
     183    /**
     184     * In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
     185     * As of 1.3.x, use BP_Activity_Activity::get( ..., $in ) instead.
     186     *
     187     * @deprecated 1.3
     188     * @deprecated Use BP_Activity_Activity::get( ..., $in ) instead.
     189     * @param mixed $activity_ids Array or comma-separated string of activity IDs to retrieve
     190     * @param int $max Maximum number of results to return. (Optional; default is no maximum)
     191     * @param int $page The set of results that the user is viewing. Used in pagination. (Optional; default is 1)
     192     * @param int $per_page Specifies how many results per page. Used in pagination. (Optional; default is 25)
     193     * @param string MySQL column sort; ASC or DESC. (Optional; default is DESC)
     194     * @param bool $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false)
     195     * @return array
     196     * @since 1.2
     197     */
    183198    function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
    184         global $wpdb, $bp;
    185 
    186         if ( is_array( $activity_ids ) )
    187             $activity_ids = implode( ',', $activity_ids );
    188 
    189         $activity_ids = $wpdb->escape( $activity_ids );
    190 
    191         if ( empty( $activity_ids ) )
    192             return false;
    193 
    194         $pag_sql = '';
    195         if ( $per_page && $page )
    196             $pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
    197 
    198         if ( $sort != 'ASC' && $sort != 'DESC' )
    199             $sort = 'DESC';
    200 
    201         $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids}) ORDER BY date_recorded {$sort} $pag_sql" ) );
    202         $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids})" ) );
    203 
    204         if ( $display_comments )
    205             $activities = BP_Activity_Activity::append_comments( $activities );
    206 
    207         // If $max is set, only return up to the max results
    208         if ( !empty( $max ) ) {
    209             if ( (int)$total_activities > (int)$max )
    210                 $total_activities = $max;
    211         }
    212 
    213         return array( 'activities' => $activities, 'total' => (int)$total_activities );
     199        _deprecated_function( __FUNCTION__, '1.3', 'Use BP_Activity_Activity::get( ..., $in ) instead.' );
     200        return BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids );
    214201    }
    215202
  • trunk/bp-activity/bp-activity-templatetags.php

    r3576 r3580  
    424424            $link = $activities_template->activity->primary_link;
    425425        else
    426             $link = bp_core_get_user_domain( $activities_template->activity->user_id );
     426            $link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
    427427
    428428        return apply_filters( 'bp_get_activity_user_link', $link );
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r3556 r3580  
    190190
    191191    $comment_id = bp_activity_new_comment( array(
     192        'activity_id' => $_POST['form_id'],
    192193        'content' => $_POST['content'],
    193         'activity_id' => $_POST['form_id'],
    194194        'parent_id' => $_POST['comment_id']
    195195    ));
     
    200200    }
    201201
    202     if ( bp_has_activities ( 'include=' . $comment_id ) ) : ?>
     202    if ( bp_has_activities ( 'display_comments=stream&include=' . $comment_id ) ) : ?>
    203203        <?php while ( bp_activities() ) : bp_the_activity(); ?>
    204204            <li id="acomment-<?php bp_activity_id() ?>">
Note: See TracChangeset for help on using the changeset viewer.