bp_activity_admin_edit()
Display the single activity edit screen.
Description
Source
File: bp-activity/bp-activity-admin.php
function bp_activity_admin_edit() {
// @todo: Check if user is allowed to edit activity items
// if ( ! current_user_can( 'bp_edit_activity' ) )
if ( ! is_super_admin() )
die( '-1' );
// Get the activity from the database.
$activity = bp_activity_get( array(
'in' => ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,
'max' => 1,
'show_hidden' => true,
'spam' => 'all',
'display_comments' => 0
) );
if ( ! empty( $activity['activities'][0] ) ) {
$activity = $activity['activities'][0];
// Workaround to use WP's touch_time() without duplicating that function.
$GLOBALS['comment'] = new stdClass;
$GLOBALS['comment']->comment_date = $activity->date_recorded;
} else {
$activity = '';
}
// Construct URL for form.
$form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
$form_url = add_query_arg( 'action', 'save', $form_url );
/**
* Fires before activity edit form is displays so plugins can modify the activity.
*
* @since BuddyPress 1.6.0
*
* @param array $value Array holding single activity object that was passed by reference.
*/
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
<div class="wrap">
<h1><?php printf( __( 'Editing Activity (ID #%s)', 'buddyboss' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?></h1>
<?php if ( ! empty( $activity ) ) : ?>
<form action="<?php echo esc_url( $form_url ); ?>" id="bp-activities-edit-form" method="post">
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
<div id="post-body-content">
<div id="postdiv">
<div id="bp_activity_action" class="postbox">
<h2><?php _e( 'Action', 'buddyboss' ); ?></h2>
<div class="inside">
<label for="bp-activities-action" class="screen-reader-text"><?php
/* translators: accessibility text */
_e( 'Edit activity action', 'buddyboss' );
?></label>
<?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' ) ) ); ?>
</div>
</div>
<div id="bp_activity_content" class="postbox">
<h2><?php _e( 'Content', 'buddyboss' ); ?></h2>
<div class="inside">
<label for="bp-activities-content" class="screen-reader-text"><?php
/* translators: accessibility text */
_e( 'Edit activity content', 'buddyboss' );
?></label>
<?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' ) ) ); ?>
</div>
</div>
</div>
</div><!-- #post-body-content -->
<div id="postbox-container-1" class="postbox-container">
<?php do_meta_boxes( get_current_screen()->id, 'side', $activity ); ?>
</div>
<div id="postbox-container-2" class="postbox-container">
<?php do_meta_boxes( get_current_screen()->id, 'normal', $activity ); ?>
<?php do_meta_boxes( get_current_screen()->id, 'advanced', $activity ); ?>
</div>
</div><!-- #post-body -->
</div><!-- #poststuff -->
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
<?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?>
</form>
<?php else : ?>
<p><?php
printf(
'%1$s <a href="%2$s">%3$s</a>',
__( 'No activity found with this ID.', 'buddyboss' ),
esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ),
__( 'Go back and try again.', 'buddyboss' )
);
?></p>
<?php endif; ?>
</div><!-- .wrap -->
<?php
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.6.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.