This file contains 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 | |
function wpf_email_notify( $timestamp, $level, $user, $message, $source, $context ) { | |
if( $level == 'error' ) { | |
wp_mail( 'youremail@example.com', 'WP Fusion API Error', 'Error message: ' . $message . ' for user ID ' . $user ); | |
} |
This file contains 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 | |
function unlock_for_fb_referral( $can_access, $user_id, $post_id ) { | |
if( isset( $_SERVER['HTTP_REFERER'] ) && strpos( $_SERVER['HTTP_REFERER'], 'facebook') !== false ) { | |
return true; | |
} | |
return $can_access; |
This file contains 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 | |
function wpf_infusionsoft_invoices() { | |
$contact_id = wp_fusion()->user->get_contact_id(); | |
if( ! is_user_logged_in() || $contact_id == false ) { | |
return 'No contact record found.'; | |
} |
This file contains 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 | |
// Tells WP Fusion's batch process to wait one second between each operation. | |
function set_wpf_sleep_time( $seconds ) { | |
return 1; | |
} | |
add_filter( 'wpf_batch_sleep_time', 'set_wpf_sleep_time' ); |
This file contains 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 | |
// Add WooCommerce Generated Password field to Contact Fields list | |
function add_woo_password_meta_field( $meta_fields ) { | |
$meta_fields['woo_password'] = array( 'label' => 'Generated Password', 'type' => 'text', 'group' => 'woocommerce' ); | |
return $meta_fields; |
This file contains 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 | |
add_filter('wpf_user_can_access', 'my_wpf_flip_access_rules', 10, 3); | |
function my_wpf_flip_access_rules( $can_access, $user_id, $post_id ) { | |
// Optional: limit the rule flipping just to certain post IDs (1234 and 4567) | |
if( $post_id != 1234 ) { | |
return $can_access; | |
} |
This file contains 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 | |
function login_add_contact( $user_login, $user ) { | |
$cid = wp_fusion()->user->get_contact_id( $user->ID ); | |
if( empty( $cid ) ) { | |
wp_fusion()->user->user_register( $user->ID ); | |
} |
This file contains 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 | |
function set_object_type( $object_type ) { | |
return 'Lead'; | |
} | |
add_filter( 'wpf_crm_object_type', 'set_object_type' ); |
This file contains 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 | |
// Adds the two custom fields to the Contact Fields tab | |
function custom_wpf_meta_fields( $fields ) { | |
$fields['last_bill_date'] = array('label' => 'Last Bill Date', 'type' => 'date', 'group' => 'wordpress'); | |
$fields['next_bill_date'] = array('label' => 'Next Bill Date', 'type' => 'date', 'group' => 'wordpress'); | |
return $fields; |