Created
January 19, 2021 21:17
-
-
Save ideadude/c6e1d0403ee389a587d31624a6ed5fde to your computer and use it in GitHub Desktop.
Display a member's badge in bbPress replies when using Paid Memberships Pro and the Member Badges Add On.
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 | |
/** | |
* Display a member's badge on replies. | |
* Requires the Member Badge Add On https://www.paidmembershipspro.com/add-ons/member-badges/ | |
* Add this code to a Code Snippet or custom plugin. | |
* https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/ | |
*/ | |
function my_show_member_badge_in_bbpress_replies() { | |
// Make sure pmpro and bbpress are active. | |
if ( ! defined( 'PMPRO_VERSION' ) || ! class_exists( 'bbPress' ) ) { | |
return; | |
} | |
// Make sure the Member Badge Add On is active. | |
if ( ! function_exists( 'pmpromb_show_badge' ) ) { | |
return; | |
} | |
$displayed_user_id = bbp_get_reply_author_id(bbp_get_reply_id()); | |
pmpromb_show_badge( $displayed_user_id ); | |
} | |
add_action( 'bbp_theme_after_reply_author_details','my_show_member_badge_in_bbpress_replies', 10, 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment