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 | |
| if (!bwfan_is_autonami_pro_active() || version_compare(BWFAN_PRO_VERSION, '2.0.3', '>=')) { | |
| class BWFAN_Contact_Referral_ID extends BWFAN_Merge_Tag { | |
| private static $instance = null; | |
| public function __construct() { | |
| $this->tag_name = 'contact_referral_id'; | |
| $this->tag_description = __('Contact Referral ID', 'wp-marketing-automations'); |
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 | |
| add_action('init', 'generate_coupon_manually'); | |
| function generate_coupon_manually() { | |
| if (isset($_GET['generate_once']) && $_GET['generate_once'] == 'true') { | |
| // Check if admin | |
| if (!current_user_can('manage_options')) { | |
| wp_die('You do not have permission to access this page.'); | |
| } |
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 | |
| add_action('wpgens_raf_new_user_referral_id', 'process_new_user_referral', 10, 2); | |
| function process_new_user_referral($referral_id, $user_id) { | |
| // Get user data | |
| $user = get_userdata($user_id); | |
| $email = $user->user_email; | |
| // Send to Klaviyo |
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 if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| /** | |
| * @param $order_get_id | |
| * hook to thank you page referer plugin | |
| * @@@ codja | |
| */ | |
| function cj_action_woocommerce_thankyou($order_get_id) | |
| { | |
| if (class_exists('WPGens_RAF')) { |
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 | |
| /** | |
| * Hook into checkout | |
| * | |
| * @since 2.0.0 | |
| */ | |
| if (!defined('ABSPATH')) { | |
| exit; |
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 | |
| add_action('woocommerce_before_checkout_form', 'check_gens_raf_cookie_and_display_message', 10); | |
| function check_gens_raf_cookie_and_display_message() { | |
| if (isset($_COOKIE['gens_raf'])) { | |
| wc_print_notice('Thank you for using a referral link! Your discount will be applied at checkout.', 'success'); | |
| } | |
| } |
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 | |
| function user_has_activation_key($user_id) { | |
| global $wpdb; | |
| $user = $wpdb->get_row($wpdb->prepare( | |
| "SELECT user_activation_key FROM {$wpdb->users} WHERE ID = %d", | |
| $user_id | |
| )); | |
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 | |
| function override_woo_gens_raf_advance_shortcode() { | |
| remove_shortcode('WOO_GENS_RAF_ADVANCE'); | |
| add_shortcode('WOO_GENS_RAF_ADVANCE', 'custom_woo_gens_raf_advance_shortcode'); | |
| } | |
| add_action('init', 'override_woo_gens_raf_advance_shortcode'); | |
| function custom_woo_gens_raf_advance_shortcode($atts) { |
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 | |
| add_filter('wpgens_raf_code','gens_raf_code',10,1); | |
| function gens_raf_code($raf_code) { | |
| $current_user = wp_get_current_user(); | |
| if(!user_has_orders($current_user->ID) && !in_array('editor', $current_user->roles)) { | |
| return 'Referral code is available only to users with orders or Editors'; | |
| } | |
| return $raf_code; |
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 | |
| // Function to get the referrer user ID | |
| function get_referrer_user_id($rafID) { | |
| // Check if the referrer is a guest using email | |
| if (filter_var($rafID, FILTER_VALIDATE_EMAIL)) { | |
| return $rafID; | |
| } | |
| // Retrieve the referrer user ID based on the custom meta field 'gens_referral_id' | |
| $gens_users = get_users(array( |