Created
February 5, 2013 13:48
-
-
Save imath/4714556 to your computer and use it in GitHub Desktop.
Allows members to delete their own topic in BuddyPress group forums. I advise you to be very careful with this script as BuddyPress normaly only allows group admin or super admin to delete topics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Beginning of the code to copy in the functions.php of your active theme **/ | |
function bastien_own_topic_delete() { | |
if( bp_get_the_topic_is_mine() && ( !bp_is_item_admin() || !bp_is_item_mod() || !bp_current_user_can( 'bp_moderate' ) ) ) { | |
?> | |
<div class="admin-links" style="margin-right:50px!important"> | |
<a class="confirm" id="topic-delete-link" href="<?php echo wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) ;?>"><?php _e( 'Delete Topic', 'buddypress' ) ;?></a> | | |
</div> | |
<?php | |
} | |
} | |
add_action( 'bp_group_forum_topic_meta', 'bastien_own_topic_delete' ); | |
/** End of the code to copy in the functions.php of your active theme **/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment