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 | |
// Define a class for our plugin | |
class MyPlugin { | |
// Define a static property to hold the single instance of the class | |
private static $instance; | |
// Define a private constructor to prevent the class from being instantiated directly | |
private function __construct() { | |
// Add the admin settings page to the WordPress admin menu |
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 | |
/** | |
* Sets a transient to lock a user from receiving webhooks from the CRM for one minute | |
* after tags have been applied by WP Fusion. | |
* | |
* @param int $user_id The user ID. | |
*/ | |
function wpf_lock_user( $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 inherit_memberium_access_rules( $settings, $post_id ) { | |
if ( is_object( $post_id ) ) { | |
$post_id = $post_id->ID; // wpf_settings_for_meta_box passes a WP_Post. | |
} | |
if ( empty( $settings['allow_tags'] ) ) { |
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 | |
/** | |
* Modify the EDD cancel URL to point custom cancellation page. | |
* | |
* @param string $url The cancel URL. | |
* @param EDD_Subscription $subscription The subscription. | |
*/ | |
function wpf_edd_subscription_cancel_url( $url, $subscription ) { |
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 | |
// Sync YITH Request A Quote pending orders to AC as if they'd been paid. | |
function add_custom_paid_status( $statuses ) { | |
$statuses[] = 'ywraq-new'; | |
$statuses[] = 'ywraq-pending'; | |
return $statuses; |
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 tag_based_on_username( $user_id ) { | |
$user = get_user_by( 'id', $user_id ); | |
wp_fusion()->user->apply_tags( array( $user->user_login ), $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 | |
// This runs whenever WP Fusion updates an existing contact record. It re-subscribes them to the list ID specified. | |
function re_subscribe_to_list( $args ) { | |
$list_id = 1; // Update this with your list ID. | |
$args[1][ 'p[' . $list_id . ']' ] = $list_id; | |
$args[1][ 'status[' . $list_id . ']' ] = 1; |
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 | |
/** | |
* When the user's contact ID or tags are saved, prefix the usermeta key with | |
* the blog prefix of the current blog. | |
* | |
* @param bool $check Whether or not to bypass the original database | |
* check. | |
* @param int $user_id The user ID. | |
* @param string $meta_key The meta key. |