Skip to content

Groups (Pro)

Hook Reference

HookDescription
fluent_affiliate/before_create_affiliate_groupFired immediately before a new affiliate group is saved to the database.
fluent_affiliate/before_delete_affiliate_groupFired immediately before an affiliate group is permanently deleted.
fluent_affiliate/after_delete_affiliate_groupFired after an affiliate group has been permanently deleted.

fluent_affiliate/before_create_affiliate_group

Fired immediately before a new affiliate group is saved to the database.

Requires FluentAffiliate Pro.

Parameters

ParameterTypeDescription
$dataarrayThe group data about to be saved: meta_key (name), rate_type, rate, status, notes.

Source: ../fluent-affiliate-pro/app/Http/Controllers/AffiliateGroupController.php

php
add_action('fluent_affiliate/before_create_affiliate_group', function($data) {
    // Validate or log the incoming group data
    error_log('Creating group: ' . $data['meta_key']);
});

fluent_affiliate/before_delete_affiliate_group

Fired immediately before an affiliate group is permanently deleted.

Requires FluentAffiliate Pro.

Parameters

ParameterTypeDescription
$groupAffiliateGroupThe AffiliateGroup model about to be deleted.

Source: ../fluent-affiliate-pro/app/Http/Controllers/AffiliateGroupController.php

php
add_action('fluent_affiliate/before_delete_affiliate_group', function($group) {
    // Migrate affiliates in this group to a default group
    Affiliate::where('group_id', $group->id)->update(['group_id' => 0]);
});

fluent_affiliate/after_delete_affiliate_group

Fired after an affiliate group has been permanently deleted.

Requires FluentAffiliate Pro.

Parameters

ParameterTypeDescription
$groupIdintID of the deleted affiliate group.

Source: ../fluent-affiliate-pro/app/Http/Controllers/AffiliateGroupController.php

php
add_action('fluent_affiliate/after_delete_affiliate_group', function($groupId) {
    // Remove external records for this group
    delete_option('my_plugin_group_' . $groupId . '_config');
});

Released under the GPL-2.0 License.