Guest User

Untitled

a guest
Mar 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2.  
  3. abstract class MaraleWPTaoNFC {
  4. public static function pre_user_email_wpfilter( $raw_email ) {
  5.  
  6. $email = sanitize_email($raw_email);
  7.  
  8. if ( isset($_REQUEST['loginFacebook']) && $_REQUEST['loginFacebook'] == '1'
  9. && !email_exists( $email ) ) {
  10.  
  11. self::fire_wptao_contact_event( $email, '',
  12. 'Rejestracja przez Facebook\'a',
  13. 'Nextend Facebook Connect'
  14. );
  15.  
  16. remove_action( 'wp_login', 'wtbp_wptao_event_login_successful_fire', 10 );
  17. }
  18.  
  19. return $raw_email;
  20. }
  21.  
  22. private static function fire_wptao_contact_event( $email, $title='', $message='', $source='' ) {
  23. if ( is_admin() || empty( $email ) ) {
  24. return;
  25. }
  26.  
  27. $user_data = array(
  28. 'email' => $email,
  29. 'options' => array(
  30. 'allow_no_fingerptint' => false,
  31. 'only_not_identified' => true
  32. )
  33. );
  34.  
  35. $args = array(
  36. 'title' => __( 'Contact', WTBP_WPTAO_DOMAIN ),
  37. 'value' => $email,
  38. 'tags' => array( 'wp' ),
  39. 'meta' => array(
  40. 'title' => $title,
  41. 'message' => $message,
  42. 'source' => $source
  43. ),
  44. 'user_data' => $user_data
  45. );
  46.  
  47. do_action( 'wptao_track_event', 'contact', $args );
  48. }
  49. }
  50.  
  51. add_filter( 'pre_user_email', array( 'MaraleWPTaoNFC', 'pre_user_email_wpfilter' ) );
Add Comment
Please, Sign In to add comment