bp_dtheme_blog_comments

Template for comments and pingbacks.

Description

bp_dtheme_blog_comments( (mixed) $comment, (array) $args, (int) $depth ); 

To override this walker in a child theme without modifying the comments template simply create your own bp_dtheme_blog_comments(), and that function will be used instead.

Used as a callback by wp_list_comments() for displaying the comments.

Parameters (3)

0. $comment (mixed)
Comment record from database
1. $args (array)
Arguments from wp_list_comments() call
2. $depth (int)
Comment nesting level

Usage

  1. if ( !function_exists( 'bp_dtheme_blog_comments' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/functions.php'; 
  3.  
  4. // Comment record from database 
  5. $comment = null; 
  6.  
  7. // Arguments from wp_list_comments() call 
  8. $args = array(); 
  9.  
  10. // Comment nesting level 
  11. $depth = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_dtheme_blog_comments($comment, $args, $depth); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bp-themes/bp-default/functions.php  
  1. function bp_dtheme_blog_comments( $comment, $args, $depth ) { 
  2. $GLOBALS['comment'] = $comment; 
  3.  
  4. if ( 'pingback' == $comment->comment_type ) 
  5. return false; 
  6.  
  7. if ( 1 == $depth ) 
  8. $avatar_size = 50; 
  9. else 
  10. $avatar_size = 25; 
  11. ?> 
  12.  
  13. <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> 
  14. <div class="comment-avatar-box"> 
  15. <div class="avb"> 
  16. <a href="<?php echo get_comment_author_url(); ?>" rel="nofollow"> 
  17. <?php if ( $comment->user_id ) : ?> 
  18. <?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => $avatar_size, 'height' => $avatar_size, 'email' => $comment->comment_author_email ) ); ?> 
  19. <?php else : ?> 
  20. <?php echo get_avatar( $comment, $avatar_size ); ?> 
  21. <?php endif; ?> 
  22. </a> 
  23. </div> 
  24. </div> 
  25.  
  26. <div class="comment-content"> 
  27. <div class="comment-meta"> 
  28. <p> 
  29. <?php 
  30. /** translators: 1: comment author url, 2: comment author name, 3: comment permalink, 4: comment date/timestamp*/ 
  31. printf( __( '<a href="%1$s" rel="nofollow">%2$s</a> said on <a href="%3$s"><span class="time-since">%4$s</span></a>', buddypress ), get_comment_author_url(), get_comment_author(), get_comment_link(), get_comment_date() ); 
  32. ?> 
  33. </p> 
  34. </div> 
  35.  
  36. <div class="comment-entry"> 
  37. <?php if ( $comment->comment_approved == '0' ) : ?> 
  38. <em class="moderate"><?php _e( 'Your comment is awaiting moderation.', buddypress ); ?></em> 
  39. <?php endif; ?> 
  40.  
  41. <?php comment_text(); ?> 
  42. </div> 
  43.  
  44. <div class="comment-options"> 
  45. <?php if ( comments_open() ) : ?> 
  46. <?php comment_reply_link( array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ); ?> 
  47. <?php endif; ?> 
  48.  
  49. <?php if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) : ?> 
  50. <?php printf( '<a class="button comment-edit-link bp-secondary-action" href="%1$s" title="%2$s">%3$s</a> ', get_edit_comment_link( $comment->comment_ID ), esc_attr__( 'Edit comment', buddypress ), __( 'Edit', buddypress ) ); ?> 
  51. <?php endif; ?> 
  52.  
  53. </div> 
  54.  
  55. </div> 
  56.  
  57. <?php