Primary

Filters

affiliates_affiliate_area_page_content

This filter should return the desired page content for the generated default affiliate area.

Parameters

$affiliate_area_page_content string HTML page content for the default affiliate area

Returns

– string HTML page content

affiliates_setup_pages

This filter should return the IDs of generated pages.

Parameters

$post_ids array of int holding the IDs of the pages that have been generated

Returns

– array of int holding page IDs

affiliates_registration_error_validate

This filter should return true if there are validation errors for the fields of the submitted affiliate registration form.

Parameters

$error boolean current validation result

Returns

– boolean validation result

login_errors

This filter is applied to the login error message printed on the login screen. This WordPress filter is invoked when there are errors on the affiliate registration form. See login_errors.

Parameters

$errors array of string with error messages

Returns

– array of string with error messages

login_messages

This filter is applied to the login message printed on the login screen. This WordPress filter is invoked when there are messages on the affiliate registration form. See login_message.

Parameters

$messages array of string with messages

Returns

– array of string with messages

affiliates_registration_profile_url

This filter can be used to modify the profile URL that is indicated to registered users, when they are asked to fill in missing information that is required to sign them up as affiliates.

Parameters

$url string the profile URL (defaults to the one return by admin_url( "profile.php" ))

Returns

– string desired URL

affiliates_registration_before_fields

This filter is used to render markup within the affiliate registration form, before the default fields are displayed.

Parameters

$output string defaults to the empty string

Returns

– string desired output before the form fields

affiliates_registration_after_fields

This filter is used to render markup within the affiliate registration form, after the default fields are displayed.

Parameters

$output string defaults to the empty string

Returns

– string desired output after the form fields

affiliates_admin_email

This filter should be used to provide the administrator email address to which affiliate notifications are sent.

Parameters

$admin_email string admin email address

Returns

– string admin email address

affiliates_new_affiliate_registration_subject

This filter should return the email subject for notifications when a new affiliate has been registered.

Parameters

$subject string

Returns

– string email subject

affiliates_new_affiliate_registration_message

This filter should return the email body for notifications when a new affiliate has been registered.

Parameters

$message string

Returns

– string email message

affiliates_new_affiliate_registration_headers

This filter is used to add headers for the registration notification message.

Parameters

– $message string

– $params array

Returns

– string headers

affiliates_service_affiliate_id

This filter should return the referring affiliate’s ID.

Parameters

$affiliate_id int the ID of the referring affiliate
$service string the service used to recognize the referring affiliate

Returns

– int the ID of the referring affiliate or null

affiliates_earnings_display_currency

This filter should return the desired output for the currency.

Parameters

$currency_id string The three-letter currency code.

Returns

– string The desired representation.

affiliates_earnings_display_total

This filter can be used to modify the total displayed for an entry in the earnings table.

Parameters

$formatted_total string
$total string
$currency_id string

Returns

– string the formatted total

affiliates_earnings_decimals

To return the number of desired decimals when displaying an earnings total in the table.

Parameters

$decimals int defaults to 2

Returns

– int number of desired decimals

affiliates_referral_amount_decimals

Before you modify your functions.php and the database with the following query, make sure to make a full backup of your site and database. You should also test this on a staging site before using it on your production site.

The following example function can be used to modify the number of decimals used for referral amounts. You can put this in your functions.php:

function affiliates_change_decimals_example( $decimals ) {
    return 5; // 5 decimals instead of 2 used by default
}
add_filter( 'affiliates_referral_amount_decimals', 'affiliates_change_decimals_example' );

You must also change the database type of the column ‘amount’ in the ‘wp_aff_referrals’ table (here using the default ‘wp’ as prefix in the WordPress database tables).

To modify the column ‘amount’ from MySQL use the query:

ALTER TABLE wp_aff_referrals MODIFY amount DECIMAL (18,5);

affiliates_earnings_display_total_no_earnings

Can be used to modify the message that is displayed when no earnings can be shown in the table yet due to lack of referrals.

Parameters

$message string the message – defaults to ‘There are no earnings yet.’

Returns

– string the desired message

affiliates_captcha_get

This filter should return the markup for a CAPTCHA field. This field is used for affiliate registration purposes.

Parameters

$field string CAPTCHA markup
$value string the value of the CAPTCHA field

Returns

– string markup

affiliates_captcha_validate

This filter should return true if the CAPTCHA field used for affiliate registration purposes passes validation.

Parameters

$result boolean validation result, true if CAPTCHA validates
$field_value string the user-submitted value for the CAPTCHA field

affiliates_parse_request_affiliate_id

This filter should return the ID of the affiliate identified as the referring affiliate, based on the query variables of the request. A cookie identifying the referring affiliate will be placed if the affiliate ID is valid.

Parameters

$value string the value of the request parameter supposed to identify the affiliate
$affiliate_id int the ID of the affiliate that has been recognized as the referring affiliate

Returns

– int affiliate ID

affiliates_redirect_status_code

When redirection is enabled, this filter can be used to change the redirection status code. The default is 302. This applies to affiliate URLs which are redirected after being recognized.

Parameters

$status int the redirect status code (default 302)

Returns

– int desired redirect status code (only codes from 300 to 307 are allowed)

affiliates_record_referral

This filter should return true if a referral should be recorded based on the provided referral data.

Parameters

$result boolean whether a referral should be recorded
$referral_data array pertaining referral data

Returns

– boolean true if a referral should be recorded

affiliates_is_duplicate_referral

This filter should return true if a referral that is about to be recorded, would duplicate an existing referral.

Parameters

$is_duplicate boolean true if the potential referral is considered a duplicate
$atts array pertaining referral data

Returns

– boolean true if a duplicate is recognized

affiliates_add_submenu_page_function

This filter should return the function used to render the content for a submenu item in the Affiliates menu.

Parameters

$function_name string name of the function

Returns

– string name of the function

affiliates_footer

Filter used to render the footer.

Parameters

$footer string markup

Returns

– string markup

affiliates_supported_currencies

Used to modify the supported currencies used in the User Registration integration.

Parameters

$currencies array of string holding currency IDs (e.g. USD, EUR, …)

Returns

– array of string

affiliates_notifications_tokens

This filter should return the values for the tokens used in affiliate notification emails, used to notify the site admin and the referring affiliate when a referral has been granted. This filter can be used to modify and add tokens.

Parameters

$tokens array of string indexed by token keys

The following tokens are provided, additional tokens can be added by returning an enhanced array.

site_title : The title of the site.
site_url : The URL of the site.
affiliate_name : The name of the affiliate being notified.
affiliate_id : The ID of the affiliate being notified.
affiliate_email : The email address of the affiliate being notified.
referral_status : The current status of the referral.
referral_id : The ID of the referral causing the notification.

Returns

– array of string with token key-value pairs

affiliates_notifications_data_tokens

This filter should return an array of data token keys that are recognized when the site admin and the referring affiliate is notified of a referral.

Parameters

$data_tokens array integration-specific data token keys to be made available as tokens that can be used in the notification
$tokens array available tokens, key-value pairs of general notification tokens

Returns

– array of data tokens

affiliates_notifications_data

This filter should return an array of data token values available for substitution when the site admin and the referring affiliate is notified of a referral.

Parameters

$data array of integration-specific data key-value pairs
$data_tokens array of string, recognized data keys
$tokens array general available tokens

Returns

– array of data key-value pairs

affiliates_coupons_equality_test

This filter should return true if two coupons are deemed equal or false otherwise.

Parameters

– $test boolean true if the coupons are currently deemed equal
– $coupon1 string coupon code
– $coupon2 string coupon code

Returns

– boolean true if $coupon1 and $coupon2 are deemed equal

affiliates_coupon_affiliate_id

This filter should return the ID of the affiliate recognized for a coupon.

Parameters

$affiliate_id int recognized affiliate ID
$coupon string coupon code

Returns

– int affiliate ID or null

affiliates_record_referral

This filter should return true if a referral should be recorded based on the provided referral data.

Parameters

$value boolean whether the referral should be recorded
$referral_data array of referral data

Returns

– boolean true if the referral should be recorded

affiliates_tiers_output

This filter is used to modify the output of the [affiliates_tiers] shortcode.

Parameters

$output string

Returns

– string tiers output

affiliates_process_tiers_referral

The return value of this filter determines whether tiers will be processed for a referral. When a new referral is recording a commission for an affiliate and tiers are enabled, this filter shall return true if the system should also record referrals for the downline of the referring affiliate. If this filter returns true, tiers in the downline of the affiliate to which the referral identified by $referral_id has been granted will also be granted referrals for the related transaction if appropriate. The filter can be used to avoid recording tier referrals under certain conditions or to implement a replacement method for processing tiers.

The global $affiliates_enterprise_doing_tiers is only set to true after this filter has been evaluated and returned true. The value of this global can be used to ascertain whether a referral being recorded is related to tier processing (i.e. referrals being recorded for additional commissions in the downline of an affiliate) or a normal referral is directly recorded for a transaction.

Parameters

– $process boolean whether to process tiers for the referral

– $referral_id int the ID of the referral for which to process tiers

$params array the parameters passed to the add_referrals method

Returns

– boolean true if tier referrals for the transaction of the referral should be processed, false otherwise

affiliates_process_tiers_referral_type

The return value of this filter determines whether tiers will be processed for a referral, the referral type and details are provided as parameters when the filter is invoked. This filter is invoked after the affiliates_process_tiers_referral and can be used to make the decision based on further details, especially the referral type and its parameteres. This filter will only be invoked if the affiliates_process_tiers_referral allowed further processing.

The global $affiliates_enterprise_doing_tiers will have the value true when this filter is being evaluated as the filter is invoked while tier referrals are processed.

This filter can be used to implement an alternative handler to process tier referrals or to decide whether tier referrals should be recorded for the individual referral identified by $referral_id.

Parameters

– $process boolean whether to process tiers for the referral

– $referral_type string the type of the referral for which to process tiers

– $params array the parameters passed to the add_referrals method

– $referral object the row object from the referrals table for the referral identified by $referral_id

Returns

– boolean true if tier referrals for the transaction of the referral should be processed, false otherwise

affiliates_cookie_timeout_days

This filter should return the expiration of the affiliate cookie in days.

Parameters

– $days int the number of days used for cookie expiration

– $affiliate_id int the affiliate ID

Returns

– int number of days

affiliates_affiliate_stats_renderer_data

Allows to modify or extend the stored data set displayed for a referral. See Affiliates Stats Filters Example for an example usage of this filter. This filter is available from Affiliates Pro version 2.14.1 and Affiliates Enterprise version 2.14.1.

Parameters

– $data array data set for the referral

– $result object the current referral row

Returns

– array data set for the referral

affiliates_affiliate_stats_renderer_data_output

Allows to modify the output of the Details column displayed for a referral. See Affiliates Stats Filters Example for an example usage of this filter. This filter is available from Affiliates Pro version 2.14.1 and Affiliates Enterprise version 2.14.1.

Parameters

– $output string current output for the details column of the referral

– $result object row object for the current referral

Returns

– string output for the details column of the referral

affiliates_affiliate_stats_renderer_column_display_names

Allows to modify and reorder the columns used to display referrals. See Affiliates Stats Filters Example for an example usage of this filter. This filter is available from Affiliates Pro version 2.14.1 and Affiliates Enterprise version 2.14.1.

Parameters

– $column_display_names array maps keys to column display names

Returns

– array of keys mapped to column display names

affiliates_affiliate_stats_renderer_column_output

This filter is used to create the output for additional columns added via the affiliates_affiliate_stats_renderer_column_display_names filter. See Affiliates Stats Filters Example for an example usage of this filter. This filter is available from Affiliates Pro version 2.14.1 and Affiliates Enterprise version 2.14.1.

Parameters

– $output string

– $key string the column key

– $result object row object for the current referral

Returns

– string output for the column identified by key and the current row object

affiliates_banner_before

Allows to prepend HTML before the banner container div with class affiliates-banner.

Parameters

– $output string current HTML prepended, defaults to the empty string
– $atts array banner shortcode attributes

Returns

– string HTML to be prepended

affiliates_banner_after

Allows to append HTML after the banner container div with class affiliates-banner.

Parameters

– $output string current HTML appended, defaults to the empty string
– $atts array banner shortcode attributes

Returns

– string HTML to be appended

affiliates_banner_image_before

Allows to prepend HTML before the banner image container div with class banner-image.

Parameters

– $output string current HTML prepended, defaults to the empty string
– $id int identifies the banner image
– $url string identifies the banner URL
– $atts array banner shortcode attributes

Returns

– string HTML to be prepended

affiliates_banner_image_after

Allows to append HTML after the banner image container div with class banner-image.

Parameters

– $output string current HTML appended, defaults to the empty string
– $id int identifies the banner image
– $url string identifies the banner URL
– $atts array banner shortcode attributes

Returns

– string HTML to be appended

affiliates_banner_code_before

Allows to prepend HTML before the banner code container div with class banner-code.

Parameters

– $output string current HTML prepended, defaults to the empty string
– $id int identifies the banner image
– $url string identifies the banner URL
– $atts array banner shortcode attributes

Returns

– string HTML to be prepended

affiliates_banner_code_after

Allows to append HTML after the banner code container div with class banner-code.

Parameters

– $output string current HTML appended, defaults to the empty string
– $id int identifies the banner image
– $url string identifies the banner URL
– $atts array banner shortcode attributes

Returns

– string HTML to be appended

affiliates_banner

Allows to modify the output for banners.

Parameters

– $output string the current HTML
– $atts array banner shortcode attributes

Returns

– string HTML

affiliates_banner_empty_subdir

Parameters

– $empty boolean defaults to true

Returns

– boolean