I browsed the docs

I browsed the docs and I could only find a post that described that users will be redirected to a thank you page after becoming a member. Is that indeed the only way/place to do conversion tracking?

Basically, I want so send something like a (unique) member id to my conversion tracking service, is there some way to access that programatically?

Can it e.g. be passed in the redirect url?

  • Ash
    • WordPress Hacker

    Hello Bo

    You can use "ms_model_relationship_create_ms_relationship_before" hook. Here is how you can use it:

    add_action( 'ms_model_relationship_create_ms_relationship_before', 'ms_controller_member_assign_memberships_done_cb', 99, 4 );
    function ms_controller_member_assign_memberships_done_cb( $membership_id, $user_id, $gateway_id, $move_from_id ) {
    
            // Do whatever you want using $user_id :)
    
    }

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.