Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add custom email instance
- * @for myCRED Email Notifications
- * @version 1.0
- */
- add_filter( 'mycred_email_instances', 'mycred_pro_add_custom_email_instance' );
- function mycred_pro_add_custom_email_instance( $instances ) {
- // Custom instance with id "balance" (must be unique)
- $instances['less'] = array(
- 'label' => 'Balance',
- 'then' => 'balance is less then 100',
- 'end' => ''
- );
- return $instances;
- }
- /**
- * Handle custom email event
- * @for myCRED Email Notifications
- * @version 1.0
- */
- add_filter( 'mycred_get_email_events', 'mycred_pro_handle_custom_email_event', 10, 3 );
- function mycred_pro_handle_custom_email_event( $events, $request, $mycred ) {
- if ( $request['amount'] < 0 ) {
- extract( $request );
- // The limit - change to any amount you like
- $limit = 100;
- $balance = $mycred->get_users_balance( $user_id, $mycred->cred_id );
- if ( $balance < $limit )
- $events[] = 'less|then';
- }
- return $events;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement