Advertisement
designbymerovingi

#00000423

Aug 30th, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. // always make sure myCRED is installed
  2. if ( function_exists( 'mycred' ) ) {
  3.  
  4.     // Load the myCRED object
  5.     $mycred        = mycred();
  6.     $user_id       = get_current_user_id();
  7.  
  8.     // get_users_balance() returns your users balance unfortmatted
  9.     $balance       = $mycred->get_users_balance( $user_id );
  10.  
  11.     $two_weeks_ago = strtotime( '-2 weeks', current_time( 'timestamp' ) );
  12.  
  13.     // Add up points since 1970 and now
  14.     $earned_points = mycred_get_total_by_time( 0, $two_weeks_ago, NULL, $user_id );
  15.  
  16.     echo 'You have earned: ' . $mycred->format_creds( $earned_points );
  17.  
  18.     $userbalanaceeuros = $balance / 70;
  19.  
  20.     // format_creds() will render the amount formatted based on your point setup
  21.     $userbalanaceeurosdec = $mycred->format_creds( $userbalanaceeuros );
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement