designbymerovingi

myCRED Run the "Points for logins" hook earlier

Dec 30th, 2013
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. add_action( 'wp_login', 'award_points_for_logins', 1, 2 );
  2. function award_points_for_logins( $user_login, $user = NULL ) {
  3.     // If myCRED is disabled, avoid PHP fatal errors.
  4.     if ( ! class_exists( 'myCRED_Module' ) ) return;
  5.  
  6.     // Load the myCRED Hook for loggins
  7.     $prefs = get_option( 'mycred_pref_hooks', array() );
  8.     $mycred_hook = new myCRED_Hook_Logging_In( $prefs['hook_prefs'] );
  9.  
  10.     // Run the hook now
  11.     $mycred_hook->logging_in( $user_login, $user );
  12. }
Advertisement
Add Comment
Please, Sign In to add comment