Skip to content

Instantly share code, notes, and snippets.

View codelion7's full-sized avatar

Christian Freeman codelion7

  • Team Extreme
  • United States
View GitHub Profile
@codelion7
codelion7 / dashboard-tab-referrals.php
Last active March 9, 2024 05:38
AffiliateWP Template File to Filter Out Indirect Referrals from the Direct Referrals list
<?php
$affiliate_id = affwp_get_affiliate_id();
?>
<div id="affwp-affiliate-dashboard-referrals" class="affwp-tab-content">
<h4><?php _e( 'Referrals', 'affiliate-wp' ); ?></h4>
<?php
$per_page = 30;
@codelion7
codelion7 / lifetime-affiliate-check.php
Last active December 6, 2022 04:33
Allow or Deny Lifetime Affiliate Overrides - Filterable
<?php
// Prevent overwriting existing lifetime affiliate
if ( get_user_meta( $user_id, 'affwp_lc_affiliate_id', true ) ) {
if( ! (bool) apply_filters( 'affwp_lc_update_affiliate', false, $affiliate_id, $user_id, $referral, $this->context ) ) {
return true; // Allow extensions to update lifetime affiliates
}
}
@codelion7
codelion7 / add_aff_url.php
Last active March 31, 2022 20:19
Add Affiliate URL to Sub Affiliate Data in Tree View
// Run if AffiliateWP MLM is Active
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) {
/**
* Adds Affiliate URL to Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
*
* @since 1.1.6
* @return array
*/
function affwp_mlm_add_url_aff_data( $aff_data = array(), $affiliate_id = 0, $disabled_aff_data = array() ) {
@codelion7
codelion7 / gist:e6a7ad69cb76b09be7b06d1b74d92921
Created March 5, 2021 17:36
Add the Affiliate's Email Address to the Affiliate Data Dropdown in the Tree View (AffiliateWP MLM)
// Run if AffiliateWP MLM is Active
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) {
/**
* Adds Affiliate URL to Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
*
* @since 1.1.6
* @return array
*/
function affwp_mlm_add_email_aff_data( $aff_data = array(), $affiliate_id = 0, $disabled_aff_data = array() ) {
@codelion7
codelion7 / dashboard-tab-bonuses.php
Last active October 14, 2020 18:53
Add CSS Styles Inline for the Bonuses Tab of the Affiliate Area
<?php
$affiliate_id = affwp_get_affiliate_id();
$bonuses = get_active_bonuses();
$bonus_count = count( $bonuses );
// Run if AffiliateWP Ranks is Active
if ( class_exists( 'AffiliateWP_Ranks' ) ) {
$ranks = get_ranks();
}
@codelion7
codelion7 / kbs-edd-fes.php
Last active May 19, 2020 21:40
Auto-Assign KB Support Ticket to EDD FES Vendor, based on the Download/Product Submitted
<?php
if ( class_exists( 'KB_Support' ) ) {
/**
* Allow Vendors to Manage Tickets (Make them Support Agents)
*
* @since 1.0
* @return array
*/
@codelion7
codelion7 / affiliatewp-customization-cycles.php
Last active April 10, 2020 18:08
Require a Specific Rank & Product Purchase to Start a New Cycle
// Make sure AffiliateWP is active
if ( function_exists( 'affiliate_wp' ) ) {
// Make sure AffiliateWP MLM is active
//if ( ! class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) return;
/**
* Require a Specific Rank & Product Purchase to Start a New Cycle
*
* @since 1.0
@codelion7
codelion7 / sync_member_type.php
Created August 10, 2017 05:48
Sync BuddyPress Member Type to Another Blog on a Multisite Network
<?php
function sync_member_type( $user_id = 0 ) {
if ( empty( $user_id ) )
$user_id = get_current_user_id();
$memb_types = bp_get_member_type( $user_id, false );
switch_to_blog( 3 );
@codelion7
codelion7 / bp-global-member-types.php
Last active February 3, 2020 12:45
Enable Global Member Types in BuddyPress
<?php
/**
* Sets a user's buddypress member type(s) globally across all sites
*
* @since 1.0
*/
function bp_set_global_member_type( $user_id = 0, $member_type = '', $append = false ) {
// Append new member type to global member type array
if ( $append == true ) {
@codelion7
codelion7 / sync_member_type_roles.php
Created August 15, 2017 04:52
Sync the roles associated with each of the user's member types on each subsite of a multisite network
/**
* Retrieves an array of all network sites
*
* @since 1.0
* @return array
*/
function get_network_sites() {
global $wpdb;
$blogs = $wpdb->get_results("