FCHubFCHub.co

FluentCRM Integration

Deep integration with FluentCRM — 15 automation triggers, 7 actions, 7 benchmarks, 25+ smart codes, profile sections, and segment filters.

FCHub Memberships integrates deeply with FluentCRM to give you full automation control over the membership lifecycle. When FluentCRM is active (FLUENTCRM constant defined), the automation module boots at init priority 30 — after both FluentCart (priority 2) and the membership system (priority 3) have initialized.

Priority 30 Boot

FluentCRM automation components register at init priority 30. If you're hooking into membership CRM events from your own code, make sure your hooks run after priority 30 to ensure all triggers and actions are available.

Triggers

Triggers start FluentCRM automations when membership events occur. Each trigger listens to a specific WordPress action hook fired by the membership system.

TriggerHookWhen It Fires
MembershipGrantedfchub_memberships/grant_createdNew membership access is granted (purchase, manual, import)
MembershipRevokedfchub_memberships/grant_revokedMembership access is revoked (cancel, refund, admin action)
MembershipExpiredfchub_memberships/grant_expiredMembership expires naturally (validity period ends)
MembershipPausedfchub_memberships/grant_pausedMembership is paused (subscription pause, admin action)
MembershipResumedfchub_memberships/grant_resumedPaused membership is resumed
MembershipRenewedfchub_memberships/grant_renewedSubscription is renewed (recurring payment confirmed)
PaymentFailedfchub_memberships/payment_failedSubscription payment fails

The MembershipPaused trigger includes the pause reason in its context data, so you can filter automations based on whether the pause was manual, subscription-related, or system-initiated.

Actions

Actions are steps you can add to FluentCRM automations to modify membership state. Each action calls the appropriate method on AccessGrantService.

ActionWhat It Does
GrantMembershipGrant a specific plan to the contact's WordPress user. Creates grants for all plan content rules
RevokeMembershipRevoke a specific plan from the contact. Removes all grants for that plan
PauseMembershipPause the contact's membership (access suspended, grant preserved)
ResumeMembershipResume a paused membership
ExtendMembershipExtend the contact's membership by X days. Adds to the current expires_at date
ChangeMembershipPlanMove the contact from one plan to another. Revokes the old plan and grants the new one
CreateFluentCartCouponGenerate a FluentCart coupon for the contact. Stores the coupon code on the subscriber meta for use in smart codes

GrantMembership Details

The grant action creates a full membership grant including all plan content rules, drip schedules, trial configuration, and adapter calls. It's the same flow as a purchase — the only difference is the source_type is set to automation instead of order.

CreateFluentCartCoupon Details

This action creates a coupon in FluentCart and stores it on the FluentCRM subscriber for use in emails. After creating the coupon:

  • _fchub_last_coupon_code — the generated coupon code
  • _fchub_last_coupon_amount — the discount amount
  • _fchub_last_coupon_typepercentage or fixed
  • _fchub_last_coupon_expires — expiry date

These are accessible via the {{membership.coupon_code}}, {{membership.coupon_amount}}, and {{membership.coupon_expires}} smart codes in your automation emails.

Benchmarks

Benchmarks are automation steps that wait for a condition to be met before proceeding. They function as "wait until" gates in your automation flows.

BenchmarkCondition
HasActiveMembershipContact has an active membership for a specific plan
MembershipExpiredContact's membership has expired
TrialConvertedContact's trial has converted to paid
PaymentRecoveredA previously failed payment has been recovered (subscription reactivated)
MembershipResumedContact's paused membership has been resumed
MembershipPausedContact's membership has been paused
MembershipRevokedContact's membership has been revoked

Example: Win-Back Automation

  1. Trigger: MembershipExpired
  2. Wait: 3 days
  3. Action: Send "We miss you" email with {{membership.checkout_url}}
  4. Wait: 7 days
  5. Benchmark: HasActiveMembership (check if they resubscribed)
    • If met: End automation
    • If not met: Continue
  6. Action: CreateFluentCartCoupon (20% off)
  7. Action: Send "Special offer just for you" email with {{membership.coupon_code}}
  8. Wait: 14 days
  9. Benchmark: HasActiveMembership
    • If met: End automation
    • If not met: Tag as "Churned"

Smart Codes

The MembershipSmartCodes class registers 25+ smart codes under the membership group. Use these in any FluentCRM email template or automation message.

Smart CodeValue
{{membership.plan_name}}Active plan name
{{membership.plan_slug}}Active plan slug
{{membership.status}}Current grant status (active, paused, expired, revoked)
{{membership.all_plans}}Comma-separated list of all active plan names
{{membership.cancellation_reason}}Cancellation or revocation reason

Smart codes pull data from the contact's latest active grant. For per-request performance, grant and plan data is cached in static arrays.

Profile Section

The MembershipProfileSection adds a "Membership" section to the FluentCRM contact profile page. This shows:

  • Active plans with status badges
  • Grant dates and expiration dates
  • Trial status and days remaining
  • Drip progress
  • Subscription source details

This gives your support team instant visibility into a contact's membership status without leaving FluentCRM.

Segment Filters

The MembershipFilters class registers segment filters that let you create FluentCRM contact segments based on membership data:

FilterOptions
Membership StatusFilter contacts by grant status: active, paused, expired, revoked
Membership PlanFilter contacts by specific plan membership
Membership DurationFilter contacts by how long they've been a member (e.g., more than 30 days)

These filters are available in FluentCRM's contact list filtering, segment creation, and automation trigger conditions. You can combine them to create targeted segments like "Active Pro members for more than 90 days" or "Expired members who had the Basic plan."

Helpers

CheckoutUrlHelper

The CheckoutUrlHelper class generates FluentCart URLs for use in smart codes:

  • getCheckoutUrl($planId) — returns the checkout URL for a plan's linked product
  • getUpgradeUrl($planId) — returns the checkout URL for the next-tier plan
  • getSubscriptionIdFromGrant($grant) — extracts the subscription ID from a grant's source data
  • getNextBillingDate($subscriptionId) — returns the next billing date from FluentCart
  • getPaymentUpdateUrl($subscriptionId) — returns the payment method update URL

MembershipFunnelHelper

The MembershipFunnelHelper class provides utility methods for FluentCRM funnel (automation) context, helping to resolve membership data for the current contact in automation flows.

On this page