Skip to content

Affiliates

Hook Reference

HookDescription
fluent_affiliate/admin_app_renderingFired just before the admin SPA is rendered.
fluent_affiliate/affiliate_updatedFired after an affiliate record is updated by an admin.
fluent_affiliate/affiliate_status_to_{status}Fired when an affiliate's status changes.
fluent_affiliate/affiliate_createdFired after a new affiliate record is created.
fluent_affiliate/affiliate_status_to_activeSee source.

fluent_affiliate/admin_app_rendering

Fired just before the admin SPA is rendered. Useful for adding custom scripts or data.

Source: app/Hooks/Handlers/AdminMenuHandler.php

php
add_action('fluent_affiliate/admin_app_rendering', function() {
    wp_enqueue_script('my-admin-extension', MY_PLUGIN_URL . 'admin-ext.js', ['jquery'], '1.0', true);
});

fluent_affiliate/affiliate_updated

Fired after an affiliate record is updated by an admin.

Parameters

ParameterTypeDescription
$affiliateAffiliateThe updated Affiliate model.
$bystringWho triggered the update — "by_admin".
$dataarrayArray of changed data.

Source: app/Http/Controllers/AffiliateController.php

php
add_action('fluent_affiliate/affiliate_updated', function($affiliate, $by, $data) {
    // Log the change or notify an external system.
}, 10, 3);

fluent_affiliate/affiliate_status_to_{status}

Fired when an affiliate's status changes. The hook name is dynamic: the suffix is the new status (e.g. active, inactive, banned).

Parameters

ParameterTypeDescription
$affiliateAffiliateThe Affiliate model with its new status.
$prevStatusstringThe previous status, or an empty string on first activation.

Source: app/Http/Controllers/AffiliateController.php

php
// Fires for any status change
add_action('fluent_affiliate/affiliate_status_to_active', function($affiliate, $prevStatus) {
    // e.g. send a "you're approved" email
}, 10, 2);

fluent_affiliate/affiliate_created

Fired after a new affiliate record is created.

Parameters

ParameterTypeDescription
$affiliateAffiliateThe newly created Affiliate model instance.
$userUserThe WordPress User model associated with the affiliate.

Source: app/Models/User.php

php
add_action('fluent_affiliate/affiliate_created', function($affiliate, $user) {
    // Send a welcome email, sync to CRM, etc.
    my_plugin_send_affiliate_welcome($affiliate->payment_email);
}, 10, 2);

fluent_affiliate/affiliate_status_to_active

Source: app/Models/User.php

FluentAffiliate developer documentation