bp_activity_admin_edit

Display the single activity edit screen.

Description

bp_activity_admin_edit(); 

Usage

  1. if ( !function_exists( 'bp_activity_admin_edit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_activity_admin_edit(); 
  7.  

Defined (1)

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

/bp-activity/bp-activity-admin.php  
  1. function bp_activity_admin_edit() { 
  2.  
  3. // @todo: Check if user is allowed to edit activity items 
  4. // if ( ! current_user_can( 'bp_edit_activity' ) ) 
  5. if ( ! is_super_admin() ) 
  6. die( '-1' ); 
  7.  
  8. // Get the activity from the database. 
  9. $activity = bp_activity_get( array( 
  10. 'in' => ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,  
  11. 'max' => 1,  
  12. 'show_hidden' => true,  
  13. 'spam' => 'all',  
  14. 'display_comments' => 0 
  15. ) ); 
  16.  
  17. if ( ! empty( $activity['activities'][0] ) ) { 
  18. $activity = $activity['activities'][0]; 
  19.  
  20. // Workaround to use WP's touch_time() without duplicating that function. 
  21. $GLOBALS['comment'] = new stdClass; 
  22. $GLOBALS['comment']->comment_date = $activity->date_recorded; 
  23. } else { 
  24. $activity = ''; 
  25.  
  26. // Construct URL for form. 
  27. $form_url = remove_query_arg( array( 'action', 'deleted', error, 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] ); 
  28. $form_url = add_query_arg( 'action', 'save', $form_url ); 
  29.  
  30. /** 
  31. * Fires before activity edit form is displays so plugins can modify the activity. 
  32. * @since 1.6.0 
  33. * @param array $value Array holding single activity object that was passed by reference. 
  34. */ 
  35. do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?> 
  36.  
  37. <div class="wrap"> 
  38. <h1><?php printf( __( 'Editing Activity (ID #%s)', buddypress ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?></h1> 
  39.  
  40. <?php if ( ! empty( $activity ) ) : ?> 
  41.  
  42. <form action="<?php echo esc_url( $form_url ); ?>" id="bp-activities-edit-form" method="post"> 
  43. <div id="poststuff"> 
  44.  
  45. <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 
  46. <div id="post-body-content"> 
  47. <div id="postdiv"> 
  48. <div id="bp_activity_action" class="postbox"> 
  49. <h2><?php _e( 'Action', buddypress ); ?></h2> 
  50. <div class="inside"> 
  51. <label for="bp-activities-action" class="screen-reader-text"><?php 
  52. /** translators: accessibility text */ 
  53. _e( 'Edit activity action', buddypress ); 
  54. ?></label> 
  55. <?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong, em, link, block, del, ins, img, code, spell, close' ) ) ); ?> 
  56. </div> 
  57. </div> 
  58.  
  59. <div id="bp_activity_content" class="postbox"> 
  60. <h2><?php _e( 'Content', buddypress ); ?></h2> 
  61. <div class="inside"> 
  62. <label for="bp-activities-content" class="screen-reader-text"><?php 
  63. /** translators: accessibility text */ 
  64. _e( 'Edit activity content', buddypress ); 
  65. ?></label> 
  66. <?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong, em, link, block, del, ins, img, code, spell, close' ) ) ); ?> 
  67. </div> 
  68. </div> 
  69. </div> 
  70. </div><!-- #post-body-content --> 
  71.  
  72. <div id="postbox-container-1" class="postbox-container"> 
  73. <?php do_meta_boxes( get_current_screen()->id, 'side', $activity ); ?> 
  74. </div> 
  75.  
  76. <div id="postbox-container-2" class="postbox-container"> 
  77. <?php do_meta_boxes( get_current_screen()->id, 'normal', $activity ); ?> 
  78. <?php do_meta_boxes( get_current_screen()->id, 'advanced', $activity ); ?> 
  79. </div> 
  80. </div><!-- #post-body --> 
  81.  
  82. </div><!-- #poststuff --> 
  83. <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 
  84. <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> 
  85. <?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?> 
  86. </form> 
  87.  
  88. <?php else : ?> 
  89.  
  90. <p><?php 
  91. printf( 
  92. '%1$s <a href="%2$s">%3$s</a>',  
  93. __( 'No activity found with this ID.', buddypress ),  
  94. esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ),  
  95. __( 'Go back and try again.', buddypress ) 
  96. ); 
  97. ?></p> 
  98.  
  99. <?php endif; ?> 
  100.  
  101. </div><!-- .wrap --> 
  102.  
  103. <?php