bbp_author_metabox

Anonymous user information metabox.

Description

bbp_author_metabox(); 

Usage

  1. if ( !function_exists( 'bbp_author_metabox' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/admin/metaboxes.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_author_metabox(); 
  7.  

Defined (1)

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

/includes/admin/metaboxes.php  
  1. function bbp_author_metabox() { 
  2.  
  3. // Post ID 
  4. $post_id = get_the_ID(); 
  5.  
  6. // Show extra bits if topic/reply is anonymous 
  7. if ( bbp_is_reply_anonymous( $post_id ) || bbp_is_topic_anonymous( $post_id ) ) : ?> 
  8.  
  9. <p> 
  10. <strong class="label"><?php esc_html_e( 'Name:', bbpress ); ?></strong> 
  11. <label class="screen-reader-text" for="bbp_anonymous_name"><?php esc_html_e( 'Name', bbpress ); ?></label> 
  12. <input type="text" id="bbp_anonymous_name" name="bbp_anonymous_name" value="<?php echo esc_attr( get_post_meta( $post_id, '_bbp_anonymous_name', true ) ); ?>" /> 
  13. </p> 
  14.  
  15. <p> 
  16. <strong class="label"><?php esc_html_e( 'Email:', bbpress ); ?></strong> 
  17. <label class="screen-reader-text" for="bbp_anonymous_email"><?php esc_html_e( 'Email', bbpress ); ?></label> 
  18. <input type="text" id="bbp_anonymous_email" name="bbp_anonymous_email" value="<?php echo esc_attr( get_post_meta( $post_id, '_bbp_anonymous_email', true ) ); ?>" /> 
  19. </p> 
  20.  
  21. <p> 
  22. <strong class="label"><?php esc_html_e( 'Website:', bbpress ); ?></strong> 
  23. <label class="screen-reader-text" for="bbp_anonymous_website"><?php esc_html_e( 'Website', bbpress ); ?></label> 
  24. <input type="text" id="bbp_anonymous_website" name="bbp_anonymous_website" value="<?php echo esc_attr( get_post_meta( $post_id, '_bbp_anonymous_website', true ) ); ?>" /> 
  25. </p> 
  26.  
  27. <?php else : ?> 
  28.  
  29. <p> 
  30. <strong class="label"><?php esc_html_e( 'ID:', bbpress ); ?></strong> 
  31. <label class="screen-reader-text" for="bbp_author_id"><?php esc_html_e( 'ID', bbpress ); ?></label> 
  32. <input type="text" id="bbp_author_id" name="post_author_override" value="<?php echo esc_attr( bbp_get_global_post_field( 'post_author' ) ); ?>" data-ajax-url="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_suggest_user' ), admin_url( 'admin-ajax.php', 'relative' ) ) ), 'bbp_suggest_user_nonce' ); ?>" /> 
  33. </p> 
  34.  
  35. <?php endif; ?> 
  36.  
  37. <p> 
  38. <strong class="label"><?php esc_html_e( 'IP:', bbpress ); ?></strong> 
  39. <label class="screen-reader-text" for="bbp_author_ip_address"><?php esc_html_e( 'IP Address', bbpress ); ?></label> 
  40. <input type="text" id="bbp_author_ip_address" name="bbp_author_ip_address" value="<?php echo esc_attr( get_post_meta( $post_id, '_bbp_author_ip', true ) ); ?>" disabled="disabled" /> 
  41. </p> 
  42.  
  43. <?php 
  44.  
  45. do_action( 'bbp_author_metabox', $post_id );