Changeset 4239
- Timestamp:
- 04/22/2011 08:30:22 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-filters.php
r4229 r4239 157 157 */ 158 158 function bp_activity_truncate_entry( $text ) { 159 global $activities_template; 160 159 161 // The full text of the activity update should always show on the single activity screen 160 162 if ( bp_is_single_activity() ) … … 164 166 $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 ); 165 167 $excerpt = $text; 166 168 169 $id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id(); 170 167 171 if ( strlen( $excerpt ) > $excerpt_length ) 168 $excerpt = sprintf( '%1$s<span class="activity-read-more" ><a href="%2$s" rel="nofollow">%3$s</a></span>', bp_create_excerpt( $excerpt, $excerpt_length, true, '…' ), bp_get_activity_thread_permalink(), $append_text );172 $excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', bp_create_excerpt( $excerpt, $excerpt_length, true, '…' ), $id, bp_get_activity_thread_permalink(), $append_text ); 169 173 170 174 return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text ); 171 175 } 172 176 add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 177 add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 ); 173 178 ?> -
trunk/bp-activity/bp-activity-template.php
r4216 r4239 800 800 $content = '<ul>'; 801 801 foreach ( (array)$comment->children as $comment_child ) { 802 // Put the comment into the global so it's available to filters 803 $activities_template->activity->current_comment = $comment_child; 804 802 805 if ( empty( $comment_child->user_fullname ) ) 803 806 $comment_child->user_fullname = $comment_child->display_name; … … 837 840 // hidden when JS is off. 838 841 if ( is_user_logged_in() && bp_activity_can_comment_reply( $comment ) ) 839 $content .= apply_filters( 'bp_activity_comment_reply_link', '<span class="acomment-replylink"> · <a href="#acomment-' . $comment ->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>', $comment);842 $content .= apply_filters( 'bp_activity_comment_reply_link', '<span class="acomment-replylink"> · <a href="#acomment-' . $comment_child->id . '" class="acomment-reply" id="acomment-reply-' . $comment->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>', $comment_child ); 840 843 841 844 // Delete link 842 845 if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id ) { 843 $delete_url = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . $comment ->id, 'bp_activity_delete_link' );844 $content .= apply_filters( 'bp_activity_comment_delete_link', ' · <a href="' . $delete_url . '" class="delete acomment-delete" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>', $comment , $delete_url );846 $delete_url = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . $comment_child->id, 'bp_activity_delete_link' ); 847 $content .= apply_filters( 'bp_activity_comment_delete_link', ' · <a href="' . $delete_url . '" class="delete acomment-delete" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>', $comment_child, $delete_url ); 845 848 } 846 849 847 850 $content .= '</div>'; 848 $content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment ->content ) . '</div>';851 $content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment_child->content ) . '</div>'; 849 852 850 853 $content .= bp_activity_recurse_comments( $comment_child ); 851 854 $content .= '</li>'; 855 856 // Unset in the global in case of the last iteration 857 unset( $activities_template->activity->current_comment ); 852 858 } 853 859 $content .= '</ul>'; -
trunk/bp-themes/bp-default/_inc/ajax.php
r4230 r4239 320 320 add_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' ); 321 321 322 /** 323 * AJAX handler for Read More link on long activity items 324 * 325 * @package BuddyPress 326 * @since 1.3 327 */ 328 function bp_dtheme_get_single_activity_content() { 329 $activity_array = bp_activity_get_specific( array( 330 'activity_ids' => $_POST['activity_id'], 331 'display_comments' => 'stream' 332 ) ); 333 334 $activity = !empty( $activity_array['activities'][0] ) ? $activity_array['activities'][0] : false; 335 336 if ( !$activity ) 337 exit(); // todo: error? 338 339 // Activity content retrieved through AJAX should run through normal filters, but not be 340 // truncated 341 remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 342 $content = apply_filters( 'bp_get_activity_content_body', $activity->content ); 343 344 echo $content; 345 346 exit(); 347 } 348 add_action( 'wp_ajax_get_single_activity_content', 'bp_dtheme_get_single_activity_content' ); 349 322 350 /* AJAX invite a friend to a group functionality */ 323 351 function bp_dtheme_ajax_invite_user() { -
trunk/bp-themes/bp-default/_inc/global.js
r4232 r4239 265 265 return false; 266 266 } 267 }); 268 269 /* Activity "Read More" links */ 270 jq('.activity-read-more a').click(function(event) { 271 var target = jq(event.target); 272 var link_id = target.parent().attr('id').split('-'); 273 var a_id = link_id[3]; 274 var type = link_id[0]; /* activity or acomment */ 275 276 var inner_class = type == 'acomment' ? 'acomment-content' : 'activity-inner'; 277 var a_inner = jq('li#' + type + '-' + a_id + ' .' + inner_class ); 278 279 jq.post( ajaxurl, { 280 action: 'get_single_activity_content', 281 'activity_id': a_id 282 }, 283 function(response) { 284 jq(a_inner).slideUp(200,function(){ 285 jq(a_inner).html(response); 286 jq(a_inner).slideDown(200); 287 }); 288 }); 289 290 291 return false; 267 292 }); 268 293
Note: See TracChangeset
for help on using the changeset viewer.