bp_dtheme_comment_form

Applies BuddyPress customisations to the post comment form.

Description

bp_dtheme_comment_form( (array) $default_labels ); 

Parameters (1)

0. $default_labels (array)
The default options for strings, fields etc in the form

Usage

  1. if ( !function_exists( 'bp_dtheme_comment_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/functions.php'; 
  3.  
  4. // The default options for strings, fields etc in the form 
  5. $default_labels = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_dtheme_comment_form($default_labels); 
  9.  

Defined (1)

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

/bp-themes/bp-default/functions.php  
  1. function bp_dtheme_comment_form( $default_labels ) { 
  2.  
  3. $commenter = wp_get_current_commenter(); 
  4. $req = get_option( 'require_name_email' ); 
  5. $aria_req = ( $req ? " aria-required='true'" : '' ); 
  6. $fields = array( 
  7. 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', buddypress ) . ( $req ? '<span class="required"> *</span>' : '' ) . '</label> ' . 
  8. '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',  
  9. 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', buddypress ) . ( $req ? '<span class="required"> *</span>' : '' ) . '</label> ' . 
  10. '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',  
  11. 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website', buddypress ) . '</label>' . 
  12. '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',  
  13. ); 
  14.  
  15. $new_labels = array( 
  16. 'comment_field' => '<p class="form-textarea"><textarea name="comment" id="comment" cols="60" rows="10" aria-required="true"></textarea></p>',  
  17. 'fields' => apply_filters( 'comment_form_default_fields', $fields ),  
  18. 'logged_in_as' => '',  
  19. 'must_log_in' => '<p class="alert">' . sprintf( __( 'You must be <a href="%1$s">logged in</a> to post a comment.', buddypress ), wp_login_url( get_permalink() ) ) . '</p>',  
  20. 'title_reply' => __( 'Leave a reply', buddypress ) 
  21. ); 
  22.  
  23. return apply_filters( 'bp_dtheme_comment_form', array_merge( $default_labels, $new_labels ) );