Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'mycred_add', 'award_point_type_for_content_purchase', 90, 3 );
- function award_point_type_for_content_purchase( $reply, $request, $mycred ) {
- // Only applicable for content purchases and not profit share payouts
- if ( $reply === false || $request['ref'] != 'buy_content' || $request['amount'] > 0 ) return $reply;
- // The bonus point type and amount
- $bonus_type = 'mytype';
- $bonus = 10;
- // Payout the bonus
- $mycred->update_users_balance( $request['user_id'], $bonus, $bonus_type );
- // Log the bonus
- $mycred->add_to_log(
- $request['ref'],
- $request['user_id'],
- $bonus,
- 'Bonus %plural% for content purchase',
- $request['ref_id'],
- $request['data'],
- $bonus_type
- );
- return $reply;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement