Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_chainedquiz() {
- if ( ! function_exists( 'wp_fusion' ) ) { // Just in case they deactivate WPF, we don't want it to break
- return;
- }
- $email = sanitize_email( $_POST['chainedemail'] );
- $contact_id = wp_fusion()->crm->get_contact_id( $email );
- $contact_data = array(
- 'user_email' => $email,
- 'first_name' => 'fname', // Populate this with the first name
- 'last_name' => 'lname', // Populate this with the last name
- );
- if ( false === $contact_id ) {
- // Add new contact
- $contact_id = wp_fusion()->crm->add_contact( $contact_data );
- } else {
- // Update existing contact
- wp_fusion()->crm->update_contact( $contact_id, $contact_data );
- }
- }
- add_action( 'wp_ajax_nopriv_chainedquiz_ajax', 'wpf_chainedquiz', 5 ); // Priority 5 so it runs before the main action
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement