bb_post_admin

The BuddyPress bb post admin function.

Description

bb_post_admin( (null) $args = null ); 

Parameters (1)

0. $args — Optional. (null) => null
The args.

Usage

  1. if ( !function_exists( 'bb_post_admin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The args. 
  5. $args = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_post_admin($args); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_post_admin( $args = null ) 
  2. $defaults = array( 
  3. 'post_id' => 0,  
  4. 'before' => '',  
  5. 'after' => '',  
  6. 'before_each' => '',  
  7. 'after_each' => "\n",  
  8. 'each' => array( 
  9. 'ip' => array( 
  10. 'post_id' => 0 
  11. ),  
  12. 'edit' => array( 
  13. 'post_id' => 0 
  14. ),  
  15. 'delete' => array( 
  16. 'post_id' => 0 
  17. ),  
  18. 'undelete' => array( 
  19. 'post_id' => 0 
  20. ); 
  21. if ( isset( $args['each'] ) ) { 
  22. $each_args = $args['each']; 
  23. $_each_args = $defaults['each']; 
  24. foreach ( $each_args as $_part_name => $_part_args ) { 
  25. if ( !isset( $defaults['each'][$_part_name] ) ) { 
  26. continue; 
  27. $_each_args[$_part_name] = wp_parse_args( $_part_args, $defaults['each'][$_part_name] ); 
  28. $args = wp_parse_args( $args, $defaults ); 
  29. if ( isset( $_each_args ) ) { 
  30. $args['each'] = $_each_args; 
  31.  
  32. $parts = array(); 
  33. if ( is_array( $args['each'] ) && count( $args['each'] ) ) { 
  34. foreach ( $args['each'] as $_part_name => $_part_args ) { 
  35. if ( $args['post_id'] && !$_part_args['post_id'] ) { 
  36. $_part_args['post_id'] = $args['post_id']; 
  37. if ( $args['before_each'] && !$_part_args['before'] ) { 
  38. $_part_args['before'] = $args['before_each']; 
  39. if ( $args['after_each'] && !$_part_args['after'] ) { 
  40. $_part_args['after'] = $args['after_each']; 
  41. $_part_function = 'bb_get_post_' . $_part_name . '_link'; 
  42. $parts[$_part_name] = $_part_function( $_part_args ); 
  43.  
  44. // For the benefit of filters, mark the final part 
  45. if ( !isset( $args['last_each'] ) ) { 
  46. $args['last_each'] = $_part_args; 
  47.  
  48. $parts = apply_filters( 'bb_post_admin', $parts, $args ); 
  49.  
  50. if ( !count( $parts ) ) { 
  51. return; 
  52.  
  53. echo $args['before'] . join( '', $parts ) . $args['after'];