Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // always make sure myCRED is installed
- if ( function_exists( 'mycred' ) ) {
- // Load the myCRED object
- $mycred = mycred();
- $user_id = get_current_user_id();
- // get_users_balance() returns your users balance unfortmatted
- $balance = $mycred->get_users_balance( $user_id );
- $two_weeks_ago = strtotime( '-2 weeks', current_time( 'timestamp' ) );
- // Add up points since 1970 and now
- $earned_points = mycred_get_total_by_time( 0, $two_weeks_ago, NULL, $user_id );
- echo 'You have earned: ' . $mycred->format_creds( $earned_points );
- $userbalanaceeuros = $balance / 70;
- // format_creds() will render the amount formatted based on your point setup
- $userbalanaceeurosdec = $mycred->format_creds( $userbalanaceeuros );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement