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_action( 'mycred_paid_for_woo', 'mycred_apply_purchased_disk_space', 10, 2 ); | |
function mycred_apply_purchased_disk_space( $order, $cui ) { | |
if ( ! function_exists( 'get_site_option' ) ) return; | |
$space_bought = 0; | |
// Loop though all items in order to see if we bought space | |
$items = $order->get_items(); | |
foreach ( $items as $item ) { | |
// Check for the custom field we set with the amount |
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
/** | |
* Restrict bbPress Forum Points | |
* If a forum has the custom field "NO_MYCRED_POINTS" set to "yes" | |
* no points are awarded for any action taken in the forum. | |
* @version 1.0 | |
*/ | |
add_filter( 'mycred_add', 'mycred_disable_bbp_forum_points', 98, 3 ); | |
function mycred_disable_bbp_forum_points( $reply, $request, $mycred ) { | |
// If already declined or bbPress is not installed, bail. | |
if ( $reply === false || ! function_exists( 'bbp_get_topic_forum_id' ) ) |
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
function custom_mycred_log_admin_screen() { | |
$args = array( | |
'number' => 10 | |
); | |
if ( isset( $_GET['user_id'] ) && ! empty( $_GET['user_id'] ) ) | |
$args['user_id'] = $_GET['user_id']; | |
if ( isset( $_GET['s'] ) && ! empty( $_GET['s'] ) ) |
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( 'default_title', 'mycred_pro_generate_coupon_code', 10, 2 ); | |
function mycred_pro_generate_coupon_code( $post_title, $post ) { | |
if ( ! isset( $post->post_type ) || $post->post_type != 'mycred_coupon' ) | |
return $post_title; | |
return wp_generate_password( 12, false, false ); | |
} |
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_content_sales', 'mycred_render_content_sales_shortcode' ); | |
function mycred_render_content_sales_shortcode( $attr ) { | |
global $wpdb; | |
$mycred_log = $wpdb->prefix . 'myCRED_log'; | |
$sales = $wpdb->get_results( " | |
SELECT DISTINCT ref_id AS post_id, COUNT( * ) AS sales | |
FROM {$mycred_log} |
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
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
/** | |
* MyCred Hook | |
* @since v2 | |
* @version 1.1 | |
*/ | |
class Wsi_MyCreed extends myCRED_Hook { | |
/** | |
* Construct | |
*/ |