Stripe, the marketplaces, AI Mailer and WP Sync are all built in, so most sites never need a line of code. These hooks are for developers who want to connect memberships to something else: another payment system, an in-house tool, an autoresponder the plugin does not know, or a rule the plugin does not model.
Put hook code in a small custom plugin or your theme's functions file. Every hook below is called by ResultsAiX Membership 1.4.25.
Prefer no code at all?
The REST API, outgoing webhooks, WordPress abilities and WP-CLI cover most of what these hooks do, from outside WordPress. See API, Webhooks And WP-CLI For Apps And AI Agents.
Giving a level from your own code:
Call RAXM_Members::add with a user id, a level id and an array of details, for example a source and a transaction reference:
RAXM_Members::add( $user_id, $level_id, array( 'source' => 'my_shop', 'txn_ref' => 'ORDER-1001' ) );
It returns the membership row id. It is safe to call twice for the same sale: the existing membership is updated, never duplicated, and the original join date is kept. The array also takes status, joined_at and expires_at; leave expires_at out and the level's own Membership expires after days are used.
To change a status, call RAXM_Members::set_status with the user id, the level id and one of active, cancelled, expired, pending or removed. To take a level away, call RAXM_Members::remove with the user id and level id.
Reacting to membership changes:
- raxm_member_added fires whenever somebody gains a level, with the user id, the level id and the membership row. The row carries the source, so you can tell a checkout from a level action or an import.
- raxm_member_registered fires when somebody signs up through a [raxm_register] form or a join link, with the user id, level id, email and name. This is the one to hook for a welcome email from another system.
- raxm_member_removed fires with the user id and level id whenever a membership stops being active: cancelled, removed, set to pending, or ended.
- raxm_member_reactivated fires with the user id, level id and the previous status when a cancelled or expired membership is put back.
- raxm_member_expired fires with the user id and level id when the daily job finds a membership past its end date. It makes a good renewal reminder trigger.
- raxm_poll_answered fires when a member answers a Quick Poll, with the poll id, user id, answer and the tags it added.
- raxm_gateway_sale, raxm_gateway_rebill, raxm_gateway_refund, raxm_gateway_cancel and raxm_gateway_end fire after a marketplace event has been applied, with the user id, the product mapping, the event and the marketplace name.
- raxm_access_denied fires when somebody is turned away, with the post id (0 for a protected file) and the user id (0 for a visitor).
Imports use the same raxm_member_added hook, with a source of wishlist_import, pmpro_import or csv_import. The plugin's own timeline, level actions, AI Mailer and WP Sync stay quiet during an import, so check the source if your code should do the same.
Example: tell another system about every new Gold member. Register your function with add_action( 'raxm_member_added', 'my_gold_join', 10, 3 ); and in my_gold_join( $user_id, $level_id, $row ) check that $level_id is your Gold level's id (shown in the Edit link on the Levels tab) before calling your system.
Filters that change behaviour:
- raxm_has_access receives whether access is allowed, the post id and the user id, and returns true or false. Use it for rules the plugin does not model, such as access based on a field in the member's profile.
- raxm_protect_message receives the protection message and the post id, and returns the message to show.
- raxm_can_switch_to receives true, the member's user id and your user id. Return false to turn View as off for that member, or for everyone.
- raxm_menu_admin_bypass receives false, the menu item id and the user id. Return true to let administrators see every menu item whatever its rule.
- raxm_protectable_taxonomies receives the list of taxonomies shown on the Protect Content tab, so you can add or remove one.
- raxm_api_capability returns the capability the REST API asks for, manage_options by default.
- raxm_visible_gateways receives the marketplace rows shown on the Integrations tab.
Adding to the member's pages:
- raxm_profile_extra receives an empty string and the user id. Return HTML to add it to the member's profile page.
- raxm_panel_sections receives an empty string and the user id. Return HTML to add a section to the admin side panel.
Writing to a member's timeline:
Any plugin can add a line to a member's timeline, which shows in their side panel and on their profile page:
do_action( 'raxm_timeline', $user_id, 'note', 'Booked a portfolio review call', array( 'plugin' => 'my-booking-plugin' ) );
The second value is the type. note is the safe choice; the timeline also knows joined, removed, cancelled, reactivated, expired, registered, login, order, refund, action and sync. Put a level id in the array as level_id to link the line to a level.
When a payment is recorded:
Every real payment fires the shared ResultsAiX payment hook, raix_payment_recorded, with an array and the source membership. The array carries:
- email and first_name
- type: sale, renewal or refund
- amount_cents and tax_cents
- currency, gateway and txn_id
- product_ref (the level slug for a Stripe checkout, the product code for a marketplace) and product_name
- occurred_at, when it happened
That hook is how the other ResultsAiX plugins report on your sales without sharing an orders table. Three rules hold every time:
- Test mode never fires it, so a practice purchase never reaches a report as real money.
- A refund arrives as its own event with a negative amount, never as an edit to the original sale.
- The transaction id is unique per payment, so a replayed notification cannot be counted twice.
A paid level changes nothing here:
raxm_member_added still fires when a payment gives the level, with the order reference in the row, so code written for a free site keeps working the day you start charging.
A real example:
Yoursite Academy books portfolio reviews in a separate booking plugin. A few lines connect the two: on raxm_member_added for Pro Coaching, the booking plugin opens two free review slots for that member, and writes "Two portfolio reviews added" to the member's timeline with do_action raxm_timeline. On raxm_member_removed for Pro Coaching, it closes any unused slots.
Tips:
- Hook raxm_member_registered for things that should happen once, at sign-up, and raxm_member_added for things that follow every level.
- Use the level slug or id from the Levels tab; the slug never changes when a level is renamed unless you edit it.
- Test hook code on a staging copy with the sandbox on. See Testing A Sale Without Spending Money.
Related guides: API, Webhooks And WP-CLI For Apps And AI Agents, Level Actions And Bundles, AI Mailer And WP Sync.