Posted on Leave a comment

[affiliates_show_list] shortcode

With this shortcode you can display a list of affiliates anywhere.
Add this code in your functions.php file and you could use the shortcode [affiliates_show_list]

add_shortcode( 'affiliates_show_list', 'affiliates_show_list' );
function affiliates_show_list( $atts ) {
global $wpdb;
$affiliates = affiliates_get_affiliates();
$output = "";
if ( is_array( $affiliates ) && ( sizeof( $affiliates ) > 0 ) ) {
$output .= '<ul>';
foreach ( $affiliates as $affiliate ) {
$output .= '<li>' . $affiliate['name'] . '</li>';
}
$output .= '</ul>';
}
return $output;
}

This is an extra function to Affiliates plugin by @itthinx.

Posted on Leave a comment

[aff_permanent_count] shortcode

If you are using Affiliates Pro / Enterprise with Affiliates Permanent by @itthinx, and you need to count how many customers are linked to an affiliate, this shortcode can help you:

add_shortcode( 'aff_permanent_count', 'aff_permanent_count' );
function aff_permanent_count( $atts ) {
global $wpdb;
$affiilate_id = Affiliates_Affiliate_WordPress::get_user_affiliate_id();
$meta_key = Affiliates_Permanent::REFERRER;
$meta_value = $affiilate_id;
$user_meta_query = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->usermeta WHERE meta_key=%s AND meta_value=%s", $meta_key, $meta_value ) );
return number_format_i18n($user_meta_query);
}

Posted on Leave a comment

Affiliates Custom Method – if coupon

Custom method to Affiliates plugin : set 20% if coupon is not used, otherwise 10%.
If you need to customize your values, simply you need to change these static vars:

public static $default_rate = 0.20;
public static $if_coupon_rate = 0.10;

Affiliates_Custom_Method_if_coupon-1.1

[php]
/**
* Plugin Name: Affiliates Custom Method – If Coupons
* Description: Custom method: set different rates if a coupon is used.
* Version: 1.1
* Author: eggemplo
* Author URI: http://www.eggemplo.com
*/
class ACM {

public static $default_rate = 0.20;
public static $if_coupon_rate = 0.10;

public static function init() {
if (class_exists ( ‘Affiliates_Referral’ )) {
Affiliates_Referral::register_referral_amount_method ( array ( __CLASS__, ‘if_coupon’ ) );
}
}

/**
* Custom referral amount method implementation.
*
* @param int $affiliate_id
* @param array $parameters
*
*/
public static function if_coupon($affiliate_id = null, $parameters = null) {
require_once( AFFILIATES_CORE_LIB . ‘/class-affiliates-service.php’ );

$result = self::$default_rate;
if ( $custom_rate = Affiliates_Affiliate::get_attribute( Affiliates_Service::get_referrer_id(), ‘referral.rate’ ) ) {
$result = $custom_rate;
}
if (isset ( $parameters [‘post_id’] )) {
$order_id = intval( $parameters[‘post_id’] );

if ( class_exists( ‘WC_Order’ ) ) {
$order = new WC_Order();
} else {
$order = new woocommerce_order();
}
if ( $order->get_order( $order_id ) ) {
if( $order->get_used_coupons() ) {
$result = self::$if_coupon_rate;
}
}
}
$result = bcmul( $result, $parameters[‘base_amount’], 2 );

return $result;
}
}

add_action ( ‘init’, array ( ‘ACM’, ‘init’ ) );
[/php]

Posted on 58 Comments

Woocommerce Role Pricing PRO

According to the role that the visitor has, he will see a store with discount prices or not, so you can set direct discounts to subscribers, editors ….

You need:

Changelog

Version 2.4
  • Compatible with Woocommerce 2.6.3
  • Added the [wrp_show_discount] shortcode
  • Fixed multisite bug.
Verion 2.0
  • Discounts by products (now variables available)
  • Discounts by categories
  • If user has various roles, you can select the criterial (higher discount, lower discount, …)

Screenshots

wrp-product

wrp-view

wgp-settings

wrp-category

Download

Posted on 2 Comments

Karma

banner-772x250

Karma

Your users will have reason to join your website continuously, rewarding them with karma, good to use for gifts, build rankings …

The framework allows an infinite of possibilities that you can make or suggest as improvements.

Documentation

Here

Features

Get / Lose karma

You can get / lose karma:

  • When you register on the web.
  • When you comment.

You are free to use the framework to generate karma when you need it. Feedback is welcome!

Shortcodes

You have available the shortcodes:

[karma_users] to show a list of users with their karmas.

[karma_user] to show a user karma.

Widgets

Show a list of users with their karma with the “Karma Users” widget.

Download

Here

Feedback

Feedback is welcome!