Re: Broken delete buttons in 1.1.3
In version 1.0 the delete link was part of a file bp-wire-ajax.php (deprecated in version 1.1.3.), via a bp_wire_delete_link() function in bp-wire-templatetags.php that looked like this:
function bp_wire_delete_link() {
echo bp_get_wire_delete_link();
}
function bp_get_wire_delete_link() {
global $wire_posts_template, $bp;
if ( empty( $bp->current_item ) )
$uri = $bp->current_action;
else
$uri = $bp->current_item;
if ( ( $wire_posts_template->wire_post->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() ) {
if ( $bp->wire->slug == $bp->current_component || $bp->profile->slug == $bp->current_component ) {
return apply_filters( 'bp_get_wire_delete_link', '<a href="' . wp_nonce_url( $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id, 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
} else {
return apply_filters( 'bp_get_wire_delete_link', '<a href="' . wp_nonce_url( site_url( $bp->{$bp->current_component}->slug . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id ), 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
}
}
}
The same function in version 1.1.3 has some subtle differences:
function bp_wire_delete_link() {
echo bp_get_wire_delete_link();
}
function bp_get_wire_delete_link() {
global $wire_posts_template, $bp;
if ( empty( $bp->current_item ) )
$uri = $bp->current_action;
else
$uri = $bp->current_item;
if ( ( $wire_posts_template->wire_post->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() ) {
if ( $bp->wire->slug == $bp->current_component || $bp->profile->slug == $bp->current_component ) {
return apply_filters( 'bp_get_wire_delete_link', '<a class="item-button delete-post confirm" href="' . wp_nonce_url( $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id, 'bp_wire_delete_link' ) . '">' . __('Delete', 'buddypress') . '</a>' );
} else {
return apply_filters( 'bp_get_wire_delete_link', '<a class="item-button delete-post confirm" href="' . wp_nonce_url( site_url( $bp->{$bp->current_component}->slug . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id ), 'bp_wire_delete_link' ) . '">' . __('Delete', 'buddypress') . '</a>' );
}
}
}
I’ll try to replace some code and will report back…