Last active
March 14, 2018 06:49
-
-
Save marekale/6e1ffddca74f20f3d35624aa3308b135 to your computer and use it in GitHub Desktop.
WP Tao and Nextend Facebook Connect 2.0.2 integration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class MaraleWPTaoNFC { | |
public static function pre_user_email_wpfilter( $raw_email ) { | |
$email = sanitize_email($raw_email); | |
if ( isset($_REQUEST['loginFacebook']) && $_REQUEST['loginFacebook'] == '1' | |
&& !email_exists( $email ) ) { | |
self::fire_wptao_contact_event( $email, '', | |
'Rejestracja przez Facebook\'a', | |
'Nextend Facebook Connect' | |
); | |
remove_action( 'wp_login', 'wtbp_wptao_event_login_successful_fire', 10 ); | |
} | |
return $raw_email; | |
} | |
private static function fire_wptao_contact_event( $email, $title='', $message='', $source='' ) { | |
if ( is_admin() || empty( $email ) ) { | |
return; | |
} | |
$user_data = array( | |
'email' => $email, | |
'options' => array( | |
'allow_no_fingerptint' => false, | |
'only_not_identified' => true | |
) | |
); | |
$args = array( | |
'title' => __( 'Contact', WTBP_WPTAO_DOMAIN ), | |
'value' => $email, | |
'tags' => array( 'wp' ), | |
'meta' => array( | |
'title' => $title, | |
'message' => $message, | |
'source' => $source | |
), | |
'user_data' => $user_data | |
); | |
do_action( 'wptao_track_event', 'contact', $args ); | |
} | |
} | |
add_filter( 'pre_user_email', array( 'MaraleWPTaoNFC', 'pre_user_email_wpfilter' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment