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
/** | |
* Custom myCRED Widget: This weeks leaderboard | |
* This widget will show this weeks leaderbaord with the option to set | |
* a title, the number of users to include and if it should be visible for | |
* non-members. | |
* @install Paste into your theme or child-themes functions.php file or custom plguin. | |
* @author Gabriel S Merovingi | |
* @version 1.3 | |
*/ | |
add_action( 'mycred_widgets_init', 'mycred_load_this_weeks_leaderboard_widget' ); |
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
/** | |
* Convert myCRED Points into WooCommerce Coupon | |
* Requires myCRED 1.4 or higher! | |
* @version 1.3.1 | |
*/ | |
add_shortcode( 'mycred_to_woo_coupon', 'mycred_pro_render_points_to_coupon' ); | |
function mycred_pro_render_points_to_coupon( $atts, $content = NULL ) { | |
// Users must be logged in | |
if ( ! is_user_logged_in() ) |
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
/** | |
* Apply Default OG:Image for Jetpack | |
* When looking for images in posts that falls under "is_singular" | |
* and Jetpack does not find an image, we apply our own default image | |
* instead of the blank WordPress thumb. | |
* @version 1.0 | |
*/ | |
add_filter( 'jetpack_images_get_images', 'apply_default_image_for_jetpack_seo', 10, 3 ); | |
function apply_default_image_for_jetpack_seo( $media, $post_id, $args ) { | |
// Jetpack_PostImages::get_images did not find anything |
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
/** | |
* Convert myCRED Points into MarketPress Coupon | |
* @version 1.1 | |
*/ | |
add_shortcode( 'mycred_to_mpress_coupon', 'mycred_pro_render_points_to_marketpress_coupon' ); | |
function mycred_pro_render_points_to_marketpress_coupon( $atts, $content = NULL ) { | |
// Users must be logged in | |
if ( ! is_user_logged_in() ) | |
return 'You must be logged in to generate store coupons.'; |
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
/** | |
* BP Checkins | |
* @requires myCRED 1.3 + | |
* @since 0.1 | |
* @version 1.0 | |
*/ | |
if ( class_exists( 'myCRED_Hook' ) && ! class_exists( 'myCRED_BP_Checkins' ) ) { | |
class myCRED_BP_Checkins extends myCRED_Hook { | |
/** |
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
/** | |
* Custom Shortcode: Limited Content Purchases | |
* Example WordPress shortcode to impose a maximum number of times | |
* a user can purchase a post in WordPress using the myCRED Sell Content add-on. | |
* Requires myCRED 1.4 or higher! | |
* @version 1.1 | |
*/ | |
add_shortcode( 'mycred_sell_this_limited', 'mycred_render_sell_this_limited' ); | |
function mycred_render_sell_this_limited( $atts, $content = NULL ) { | |
// First make sure we do not get an error if myCRED gets deactivated |
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
/** | |
* Disable Content Sales | |
* Disabled content sales after 3 purchases. | |
* @version 1.0 | |
*/ | |
add_filter( 'mycred_add', 'mycred_limit_content_sales', 10, 3 ); | |
function mycred_limit_content_sales( $reply, $request, $mycred ) { | |
// Only apply this to content purchases | |
if ( $reply === false || $request['ref'] != 'buy_content' ) 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
/** | |
* [mycred_lottery_results] Shortcode Render | |
* @since 1.0 | |
* @version 1.2 | |
*/ | |
if ( ! function_exists( 'mycred_lotto_render_draws' ) ) : | |
function mycred_lotto_render_draws( $atts, $content = NULL ) | |
{ | |
extract( shortcode_atts( array( | |
'id' => NULL, |
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_add', 'mycred_absolute_limit_for_comments', 20, 3 ); | |
function mycred_absolute_limit_for_comments( $reply, $request, $mycred ) { | |
// Ignore declined instances or instances that are not comment related | |
if ( $reply === false || $request['ref'] != 'approved_comment' ) return $reply; | |
// The user ID | |
$user_id = absint( $request['user_id'] ); | |
// Count the number of times this user has received points for comments. | |
$total = mycred_count_ref_instances( 'approved_comment', $user_id ); |
OlderNewer