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
/** | |
* Show Affiliate ID | |
* Inserts the displayed users affiliate ID | |
* in their bbPress profile. | |
* @version 1.0 | |
*/ | |
add_action( 'bbp_template_after_user_profile', 'mycred_pro_show_affiliate_id_in_bbp_profile' ); | |
function mycred_pro_show_affiliate_id_in_bbp_profile() { | |
$user_id = bbp_get_displayed_user_id(); | |
$affiliate_link = get_user_meta( $user_id, 'mycred_affiliate_link', true ); |
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
add_filter( 'mycred_admin_inline_editor', 'mycred_pro_adjust_inline_editor' ); | |
function mycred_pro_adjust_inline_editor() { | |
$options = array( | |
'%plural% for doing something', | |
'adjustments for something else', | |
'%plural% for a third thing' | |
); | |
ob_start(); ?> |
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
/** | |
* Get Total Points on Site | |
* Will add up all your users current balances for a given | |
* myCRED point type. | |
* @version 1.0 | |
*/ | |
function mycred_pro_total_points_on_my_site( $type = 'mycred_default' ) { | |
global $wpdb; | |
$type = sanitize_text_field( $type ); |
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
/** | |
* Promote Based on Balance | |
* Changes a users role based on their myCRED balance. | |
* @version 1.0.4 | |
*/ | |
add_filter( 'mycred_add_finished', 'check_for_role_change', 99, 3 ); | |
function check_for_role_change( $reply, $request, $mycred ) { | |
// Make sure that if any other filter has declined this we also decline | |
if ( $reply === false ) return $reply; |
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
add_shortcode( 'mycred_conditional_link', 'mycred_render_conditional_link' ); | |
function mycred_render_conditional_link( $atts, $content ) { | |
// Make sure myCRED is installed | |
if ( ! function_exists( 'mycred' ) ) return 'myCRED is not installed'; | |
// Not applicable for visitors | |
if ( ! is_user_logged_in() ) return; | |
$atts = shortcode_atts( array( |
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
add_shortcode( 'mycred_max_link', 'mycred_render_max_link' ); | |
function mycred_render_max_link( $atts, $content ) { | |
// Make sure myCRED is installed | |
if ( ! function_exists( 'mycred' ) ) return 'myCRED is not installed'; | |
// Not applicable for visitors | |
if ( ! is_user_logged_in() ) return; | |
$atts = shortcode_atts( array( |
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
/** | |
* Register Custom Hook | |
* Comment Popularity | |
* @see https://github.com/humanmade/comment-popularity | |
*/ | |
add_filter( 'mycred_setup_hooks', 'mycred_pro_register_comment_pop_hook' ); | |
function mycred_pro_register_comment_pop_hook( $installed ) { | |
$installed['comment_pop'] = array( | |
'title' => __( 'Comment Popularity', 'textdomain' ), |
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
/** | |
* MyCred Hook | |
* @since v2 | |
* @version 1.1 | |
*/ | |
class Wsi_MyCreed extends myCRED_Hook { | |
/** | |
* Construct | |
*/ |
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
add_shortcode( 'mycred_create_bulk_coupons', 'mycred_render_bulk_coupon_creation' ); | |
function mycred_render_bulk_coupon_creation() { | |
if ( ! current_user_can( 'manage_options' ) ) return 'You do not create coupons.'; | |
if ( ! function_exists( 'mycred_create_new_coupon' ) ) return 'The Coupon add-on is not enabled!'; | |
if ( isset( $_POST['mycred_coupon_bulk'] ) && isset( $_POST['cc-token'] ) && wp_verify_nonce( $_POST['cc-token'], 'mycred-coupon-bulk-create' ) ) { | |
$number = $_POST['mycred_coupon_bulk']['number']; | |
$value = $_POST['mycred_coupon_bulk']['value']; |