Skip to content

Instantly share code, notes, and snippets.

👨‍💻
developing ...

Antonio Blanco eggemplo

👨‍💻
developing ...
Block or report user

Report or block eggemplo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eggemplo
eggemplo / functions.php
Created Jul 13, 2017
Fixes the Categories Widget count
View functions.php
function ix_change_term_counts( $terms, $taxonomies ) {
global $wp_query;
if ( is_admin() || is_ajax() ) {
return $terms;
}
if ( ! isset( $taxonomies[0] ) ) {
return $terms;
}
@eggemplo
eggemplo / functions.php
Created May 30, 2017
Affiliates Gravity Form - extra referral
View functions.php
add_action( 'affiliates_referral', 'my_gf_extra_referral_affiliates_referral', 10, 2 );
function my_gf_extra_referral_affiliates_referral ( $referral_id, $info ) {
if ( $info['type'] == Affiliates_Gravity_Forms::REFERRAL_TYPE ) {
$description = "Gravity Form extra dollar";
$amount = 1;
$currency_id = "USD";
$affiliate_id = $info['affiliate_id'];
if ( class_exists( 'Affiliates_Referral_WordPress' ) ) {
$r = new Affiliates_Referral_WordPress();
View functions_decent_comments_random.php
add_filter( 'decent_comments_comments_output', 'random_decent_comments_comments_output', 10, 3 );
function random_decent_comments_comments_output ( $output, $comments, $options ) {
shuffle( $comments );
extract( Decent_Comments_Renderer::$defaults );
// display options
if ( isset( $options['avatar_size'] ) ) {
$avatar_size = intval( $options['avatar_size'] );
View affiliates_woocommerce_checkout_order_processed.php
// check if product ID has been purchased
add_action( 'woocommerce_checkout_order_processed', 'bbloomer_check_order_product_id', 10, 1 );
function bbloomer_check_order_product_id( $order_id ){
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
if ( $product_id == 17563 || $product_id == 17558 ) {
$order = new WC_Order( $order_id );
$user_id = $order->user_id;
View Groups woocommerce_product_is_visible filter
add_filter( 'woocommerce_product_is_visible', 'my_woocommerce_product_is_visible', 10, 2 );
function my_woocommerce_product_is_visible ( $visible, $product_id ) {
if ( $visible ) {
$visible = Groups_Post_Access::user_can_read_post( $product_id );
}
return $visible;
}
@eggemplo
eggemplo / my_action_woocommerce_checkout_order_processed
Created Oct 25, 2016
when a user purchases, it becomes affiliate
View my_action_woocommerce_checkout_order_processed
function my_action_woocommerce_checkout_order_processed( $order_id ) {
$order = new WC_Order( $order_id );
$user_id = $order->user_id;
$user = get_user_by('ID', $user_id);
if ( function_exists( 'affiliates_get_user_affiliate' ) ) {
$affiliates = affiliates_get_user_affiliate( $user->ID );
if ( empty( $affiliates ) ) {
$first_name = get_user_meta( $user->ID, 'first_name', true );
View facilitator.php
add_action ( 'woocommerce_checkout_order_processed', 'add_facilitator_commission' );
/**
* Record a product referral when a new order has been saved.
* @param int $order_id
*/
function add_facilitator_commission( $order_id ) {
$product_options = array();
// You need to replicate this code for each product. In this case, 10 is the product ID
View filter_woocommerce_json_search_found_customers.php
add_filter( 'woocommerce_json_search_found_customers', 'my_woocommerce_json_search_found_customers', 10 , 1 );
function my_woocommerce_json_search_found_customers ( $found_customers ) {
foreach ( $found_customers as $key=>$customer ) {
// use id to check if user is VIP
$is_a_member = false;
require_once( ABSPATH . 'wp-includes/pluggable.php' );
if ( $group1 = Groups_Group::read_by_name( 'VIP1' ) || $group2 = Groups_Group::read_by_name( 'VIP2' ) ) {
$is_a_member = ( Groups_User_Group::read( $customer->ID , $group1->group_id ) || Groups_User_Group::read( $customer->ID , $group2->group_id ) );
}
View Affiliates_Custom_Method_only_coupon.php
<?php
/**
* Plugin Name: Affiliates Custom Method - Only Coupons
* Description: Custom method: Only if a coupon, then commissions are assigned
* Version: 1.0
* Author: eggemplo
* Author URI: http://www.eggemplo.com
*/
class ACM {
View affiliates_permanent_my_users
function my_affiliates_permanent_my_users( $atts ){
$output = "";
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
if ( null !== ( affiliates_get_user_affiliate( $user->ID ) ) ) {
$affiliate_id = affiliates_get_user_affiliate( $user->ID );
$args = array(
'meta_key' => Affiliates_Permanent::REFERRER,
'meta_value' => $affiliate_id
You can’t perform that action at this time.