View mycred-get-woo-product-reward-example
if ( function_exists( 'mycred_get_woo_product_reward' ) ) {
$product_id = 1;
$point_type = MYCRED_DEFAULT_TYPE_KEY;
$reward = mycred_get_woo_product_reward( $product_id, NULL, $point_type );
if ( $reward !== false && $reward != '' )
printf( 'Earn %s Points buying this product.', $reward );
}
View add-timeframe-option-to-total-balance
function mycred_pro_timeframe_total_balance( $query, $atts ) {
if ( ! empty( $atts ) && array_key_exists( 'based_on', $atts ) && $atts['based_on'] == 'balance' ) {
if ( array_key_exists( 'total', $atts ) && $atts['total'] == 1 && array_key_exists( 'timeframe', $atts ) && $atts['timeframe'] != '' )
$query = str_replace( "l.ref = 'manual' ) )", "l.ref = 'manual' ) ) AND time >= " . strtotime( $atts['timeframe'], current_time() ), $query );
}
return $query;
View maybe-hide-bp-charge-message
function mycred_pro_maybe_hide_message_charge( $content ) {
// Only applicable to texts starting with New Reply:
if ( substr( $content, 0, 10 ) == 'New Reply:' && function_exists( 'bp_loggedin_user_id' ) ) {
$user_id = bp_loggedin_user_id();
// If a user does not the bp_charges_pay capability
// hide the message
if ( ! user_can( 'bp_charges_pay', $user_id ) )
View bp-charges-pretend-we-can-afford
/**
* Pretend User Can Afford
* Pretend users that are exempt from being charged can afford to send
* new messages even if their balance is zero.
* @version 1.0
*/
function mycred_pro_pretend_user_can_afford( $can_afford ) {
$user_id = bp_loggedin_user_id();
View bp-charges-messages
/**
* Maybe Charge Message
* Exempt users with a specific capability from being
* charged for sending private messages in BP Charges.
* @version 1.0
*/
function mycred_pro_maybe_charge_new_message( $charge, $thread_id, $module ) {
$user_id = bp_loggedin_user_id();
View reward-woo-owners-with-points
/**
* Reward Store Sales
* @version 1.0
*/
function mycred_pro_reward_store_sales( $order_id ) {
// Prevent crashes if myCRED gets disabled
if ( ! function_exists( 'mycred' ) ) return;
// Get order
View mycred-userpro-insufficient-filter-example1
/**
* Customize UserPro Message
* @version 1.0
*/
function mycred_pro_custom_userpro_message( $message ) {
return '<div class="userpro-msg-notice">Insufficient funds. Please <a href="http://yourwebsite.com/buy-points/">top-up</a> your account to send further messages.</div>';
}
add_filter( 'mycred_userpro_insufficient', 'mycred_pro_custom_userpro_message' );
View change-wp-email-from
function enforce_dfds_email_from($old) {
return 'yourname@yourdomain.com';
}
add_filter( 'wp_mail_from', 'enforce_dfds_email_from' );
function enforce_dfds_email_from_name($old) {
return 'Your Name';
}
add_filter( 'wp_mail_from_name', 'enforce_dfds_email_from_name' );
View mycred-sell-this-button-filter-example
/**
* Adjust Sell Content Button
* @version 1.0
*/
function mycred_pro_adjust_sell_content_button( $button, $post, $setup, $mycred ) {
return '<button type="button" class="mycred-buy-this-content-button ' . $setup['button_classes'] . '" data-pid="' . $post->ID . '" data-type="' . $mycred->cred_id . '"><i class="fa fa-download" aria-hidden="true"></i></button>';
}
add_filter( 'mycred_sell_this_button', 'mycred_pro_adjust_sell_content_button', 10, 4 );
View redirect-when-out-of-mycred-points
/**
* Redirect When Out of Points
* @since 1.0
* @version 1.0
*/
function mycred_pro_redirect_when_no_more_points() {
// The Page ID where we want users to be redirected to
// when they have run out of points
$redirect_to = 1;