Last active
January 4, 2016 19:39
-
-
Save jjeaton/8668560 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Small plugin to demonstrate how to place the bbPress Report Content links wherever you want | |
* | |
* @author Josh Eaton <http://www.josheaton.org/> | |
*/ | |
if ( ! function_exists( 'shmoo_bbp_the_topic_report_link' ) ) { | |
/** | |
* Output a topic report link | |
*/ | |
function shmoo_bbp_the_topic_report_link() { | |
$bbp_rc = bbp_ReportContent::get_instance(); | |
echo $bbp_rc->get_topic_report_link(); | |
} | |
} | |
if ( ! function_exists( 'shmoo_bbp_the_reply_report_link' ) ) { | |
/** | |
* Output a reply report link | |
* | |
* Works as of 1.0.2 | |
*/ | |
function shmoo_bbp_the_reply_report_link() { | |
$bbp_rc = bbp_ReportContent::get_instance(); | |
echo $bbp_rc->get_reply_report_link(); | |
} | |
} | |
/** | |
* Load our helper plugin | |
*/ | |
function shmoo_bbp_rc() { | |
$bbp_rc = bbp_ReportContent::get_instance(); | |
// Remove the topic & reply links | |
remove_filter( 'bbp_topic_admin_links', array( $bbp_rc, 'add_topic_admin_links' ), 10, 2 ); | |
remove_filter( 'bbp_reply_admin_links', array( $bbp_rc, 'add_reply_admin_links' ), 10, 2 ); | |
// Add our custom function to call the topic report link | |
add_action( 'bbp_theme_after_topic_author_details', 'shmoo_bbp_the_topic_report_link' ); | |
// Add our custom function to call the reply report link | |
add_action( 'bbp_theme_after_reply_author_details', 'shmoo_bbp_the_reply_report_link' ); | |
} | |
add_action( 'plugins_loaded', 'shmoo_bbp_rc' ); |
Filter (bbp_rc_get_topic_report_link) doesn't work with this custom change... It seems the class object it is used, it is not the same.
Something to keep in mind.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful! Thanks for providing! =)