Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/17/2011 05:39:42 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Tweak the activity stream styling - remove faux-buttons and replace with links. Fix bp_dtheme_new_activity_comment() so that it uses the activity/comment.php template rather than being hardcoded into the function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4648 r4668  
    178178    global $bp;
    179179
    180     /* Check the nonce */
     180    // Check the nonce
    181181    check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
    182182
     
    198198    $comment_id = bp_activity_new_comment( array(
    199199        'activity_id' => $_POST['form_id'],
    200         'content' => $_POST['content'],
    201         'parent_id' => $_POST['comment_id']
    202     ));
     200        'content'     => $_POST['content'],
     201        'parent_id'   => $_POST['comment_id']
     202    ) );
    203203
    204204    if ( !$comment_id ) {
     
    207207    }
    208208
    209     if ( bp_has_activities ( 'display_comments=stream&include=' . $comment_id ) ) : ?>
    210         <?php while ( bp_activities() ) : bp_the_activity(); ?>
    211             <li id="acomment-<?php bp_activity_id() ?>">
    212                 <div class="acomment-avatar">
    213                     <a href="<?php echo bp_core_get_userlink( bp_get_activity_user_id(), false, true ); ?>"><?php bp_activity_avatar( array( 'height' => 30, 'width' => 30 ) ); ?></a>
    214                 </div>
    215 
    216                 <div class="acomment-meta">
    217                     <?php
    218                     /* translators: 1: user profile link + username, 2: activity item permalink, 3: activity item timestamp */
    219                     printf( __( '%1$s replied <a href="%2$s">%3$s ago</a>', 'buddypress' ), bp_core_get_userlink( bp_get_activity_user_id() ), bp_get_activity_thread_permalink(), bp_core_time_since( bp_core_current_time() ) );
    220                     ?>
    221 
    222                     <a class="acomment-reply bp-primary-action" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ); ?></a>
    223 
    224                     <?php if ( bp_activity_user_can_delete() ) : ?>
    225                         <div class="acomment-options">
    226                             <a href="<?php echo wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
    227                         </div>
    228                     <?php endif; ?>
    229                 </div>
    230 
    231                 <div class="acomment-content">
    232                     <?php bp_activity_content_body(); ?>
    233                 </div>
    234             </li>
    235         <?php endwhile; ?>
    236      <?php endif;
     209    global $activities_template;
     210
     211    // Load the nem activity item into the $activities_template global
     212    bp_has_activities( 'display_comments=stream&include=' . $comment_id );
     213
     214    // Swap the current comment with the activity item we just loaded
     215    $activities_template->activity->id              = $activities_template->activities[0]->item_id;
     216    $activities_template->activity->current_comment = $activities_template->activities[0];
     217
     218    $template = locate_template( 'activity/comment.php', false, false );
     219
     220    // Backward compatibility. In older versions of BP, the markup was
     221    // generated in the PHP instead of a template. This ensures that
     222    // older themes (which are not children of bp-default and won't
     223    // have the new template) will still work.
     224    if ( empty( $template ) )
     225        $template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php';
     226
     227    load_template( $template, false );
     228
     229    unset( $activities_template );
    237230}
    238231add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' );
Note: See TracChangeset for help on using the changeset viewer.