Hooks & Filters

Key Hooks & Filters Reference

Practical action and filter examples for campaigns, projects, payments, and commission overrides with thorough explanations.

These are the most commonly used Influenzic action and filter hooks. Each example below shows the correct hook signature, a production-ready use case, and detailed instructions on how the hook functions and where it should be applied.

How to apply these hooks: You should add these hooks to your child theme’s functions.php file, or inside a custom site-specific plugin. This ensures your modifications remain intact even when the core Influenzic theme is updated.

Commission & Fee Filters

inzc_get_commission_pct (Filter)

This filter allows you to dynamically override the platform commission percentage applied to influencer payouts when a project is completed. By default, it takes the base commission rate set in the WordPress admin panel settings.

Parameters:

  • float $rate — The default platform commission percentage (e.g., 20.0 representing a 20% platform commission fee).

How it works: When a campaign project resolves and funds are released, this filter runs to compute the platform commission. The value returned must be a float representing the commission percentage. If you return 0.0, the platform commission will be completely waived for that project transaction.

add_filter( 'inzc_get_commission_pct', function( float $rate ): float {
    // Zero commission during a launch promotional period
    $launch_ts = (int) get_option( 'my_site_launch_timestamp', 0 );
    if ( $launch_ts && ( time() - $launch_ts ) < 30 * DAY_IN_SECONDS ) {
        return 0.0;
    }
    return $rate;
} );

inzc_get_processing_fee_pct (Filter)

This filter allows you to dynamically override the processing fee percentage added to brand checkout invoices on top of campaign costs.

Parameters:

  • float $rate — The default processing fee percentage (e.g., 7.0 for a 7% payment processing surcharge).

How it works: The filter runs when calculating order totals during brand checkout. It expects you to return a float representing the processing fee percentage to apply. You can check the current user ID to waive fees for specific VIP brand accounts.

add_filter( 'inzc_get_processing_fee_pct', function( float $rate ): float {
    // Waive the processing fee for specific VIP brand accounts
    $vip_ids = [ 42, 107, 305 ]; // Specific WP user IDs of VIP brands
    if ( in_array( get_current_user_id(), $vip_ids, true ) ) {
        return 0.0;
    }
    return $rate;
} );

Gateway Registry Filter

inzc_payment_gateways (Filter)

This filter allows you to register custom payment gateways or modify built-in gateways in the platform registry. It enables you to integrate local payment networks or third-party gateways.

Parameters:

  • array $gateways — An associative array of registered gateway descriptors.

How it works: During platform initialization, the gateway manager queries this filter. You append a unique gateway configuration key containing the gateway metadata (label, controller class name implementing Gateway_Interface, webhook identifier, and configuration settings) and return the modified array.

add_filter( 'inzc_payment_gateways', function( array $gateways ): array {
    $gateways['mygateway'] = [
        'id'           => 'mygateway',
        'label'        => 'My Gateway',
        'class'        => My_Gateway::class,
        'webhook_slug' => 'mygateway',
        'redux_fields' => [],
    ];
    return $gateways;
} );

Project Lifecycle Actions

inzc_project_created (Action)

This action hook fires immediately after a new project contract is created and saved to the database (e.g., when an influencer accepts an invitation or a brand funds a slot).

Parameters:

  • int $project_id — The unique database ID of the created project.
  • int $campaign_id — The parent campaign ID.
  • int $influencer_id — The WordPress user ID of the hired influencer.

How it works: This hook does not return any values. It is used to execute secondary actions, such as sending external HTTP requests, notifying admins, or syncing platform events with third-party software.

add_action( 'inzc_project_created', function( int $project_id, int $campaign_id, int $influencer_id ): void {
    // Notify your team via Slack webhook when a new project starts
    wp_remote_post( SLACK_WEBHOOK_URL, [
        'body'    => wp_json_encode( [
            'text' => "New project #{$project_id} started on campaign #{$campaign_id} with influencer #{$influencer_id}",
        ] ),
        'headers' => [ 'Content-Type' => 'application/json' ],
    ] );
}, 10, 3 );

inzc_project_completed (Action)

This action hook fires once a project is marked as completed (after content verification, review submission, and escrow payout release).

Parameters:

  • int $project_id — The completed project database ID.
  • array $project — An associative array of the project data fetched from the database, containing keys like influencer_id, payment_amount, and brand_id.

How it works: No return value is expected. Use this hook to log statistics, sync user portfolios, or update external ledgers.

add_action( 'inzc_project_completed', function( int $project_id, array $project ): void {
    my_analytics_log( 'project_completed', [
        'project_id'    => $project_id,
        'influencer_id' => $project['influencer_id'],
        'amount'        => $project['payment_amount'],
    ] );
}, 10, 2 );

Quality Score Action

inzc_quality_score_updated (Action)

This action fires right after an influencer’s quality score (0–100) and creator level (0–5) are recalculated by the platform (e.g., after reviews, cron runs, or manual triggers).

Parameters:

  • int $user_id — The WordPress user ID of the influencer.
  • int $score — The newly calculated quality score integer.
  • int $level — The resulting creator level integer (0 = Starter, 5 = Top Creator).

How it works: Use this hook to respond dynamically to influencer status changes. It does not return values, but allows you to grant rewards, restrict features, or notify users via email.

add_action( 'inzc_quality_score_updated', function( int $user_id, int $score, int $level ): void {
    // Send a congratulations email when an influencer reaches Top Creator (level 5)
    if ( 5 === $level ) {
        $user = get_userdata( $user_id );
        wp_mail(
            $user->user_email,
            'You reached Top Creator status!',
            'Congratulations — you are now a Top Creator on our platform.'
        );
    }
}, 10, 3 );

DM Rate Limit Filter

inzc_dm_daily_limit (Filter)

This filter controls the daily limit of new direct message threads a brand is permitted to initiate within 24 hours.

Parameters:

  • int $limit — The default platform daily messaging limit (typically 25 threads).

How it works: Expected to return an integer representing the maximum permitted DMs. Useful for restricting/gating limits depending on active subscription plans.

add_filter( 'inzc_dm_daily_limit', function( int $limit ): int {
    // Increase the daily DM thread limit for brands on the Pro subscription plan
    if ( inzc_brand_has_plan( get_current_user_id(), 'pro' ) ) {
        return 100;
    }
    return $limit; // default fallback: 25
} );

Was this article helpful?