• Resolved Jonathan

    (@luxman007)


    I know this is more technical, and perhaps not supported here, however GamiPress does provide a “referral add-on” especially rewarding points to referring signups…

    I have their add-on which uses a similar structure to SliceWP of the ?ref=ID and thought about running both at the same time; however, the IDs would be off and some of my members prefer the custom slug (IMO better).

    I’m aware there is a hook and listener within their plugin that I’m hoping we can tap into? IMO this would make their current addon even better for you but I can see them wanting to still promote their own referral add-on ??

    BUT, if there’s a way then SliceWP can also provide points/triggers for signups and even more for WooCommerce which is even more important.

    GamiPress referral addon:
    https://gamipress.com/add-ons/gamipress-referrals/

    Their AffiliateWP addon has trigger I’d love to have.
    https://gamipress.com/add-ons/affiliatewp-integration/

    “When a new user is registered through an affiliate link.”

    Let me know how I can help make this happen! Lets reverse engineer this.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Jonathan

    (@luxman007)

    *Correction, going through their affiliatewp plugin the trigger is:

    'gamipress_affwp_referral_signup' => __( 'Referral sign up', 'gamipress-affiliatewp-integration' ),

    Doesn’t look like there’s much to it but I’ll leave the devving up to the devs ??

    Thread Starter Jonathan

    (@luxman007)

    Got some code from the wpaffiliate addon and converted it to the best of my non-dev ability for slicewp

    https://codefile.io/f/JfTQM0ohYg

    I think something like this can work?!

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    I’m afraid that I cannot help you out with this one. As we have not developed the GamiPress integration, we know extremely little when it comes to how everything works under the hood.

    For this, I would recommend you to contact the people from GamiPress, explain in high detail what you’re trying to set up and see if they can help.

    Considering that GamiPress already have a SliceWP add-on, they may be open to your ideas and even extend the add-on, so that everyone can benefit from the feature you’re looking for.

    Please let them know that they can contact us at anytime if they’re having difficulties with the implementation you’re proposing.

    Thank you and best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    I got everything except for 1 line of code

    https://codefile.io/f/JfTQM0ohYg

    This can be a separate addon or until they release an upgrade:

    1. If a user signs up from an affiliate then we can reward them, instead of just signing up on their own.
    2. Reward the affiliate when someone signs up using their link

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    I’m not exactly sure what all the code does, but looking at the line you’ve highlighted, I’m guessing that you’re looking to grab the affiliate by the given user_id.

    If that’s the case, you can use this function: slicewp_get_affiliate_by_user_id( $user_id )

    You can read more about this function here: https://slicewp.com/docs/slicewp_get_affiliate_by_user_id/

    I hope this helps!

    Best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    The original is

    function gamipress_affwp_referral_signup( $user_id ) {
    
    $affiliate_id = affiliate_wp()->tracking->get_affiliate_id();
    
    // If new registered user has come from an affiliate, then trigger it
    if( $affiliate_id ) {
    
        // Get user id from affiliate id
        $affiliate_user_id = affwp_get_affiliate_user_id( $affiliate_id );
    
        // Trigger referral sign up event to award the affiliate that gets the new user
        do_action( 'gamipress_affwp_referral_signup', $affiliate_id, $affiliate_user_id, $user_id );
    
        // Trigger become an user through an affiliate event to award the referral that becomes as a new user
        do_action( 'gamipress_affwp_register_referral', $affiliate_id, $user_id, $affiliate_user_id );
    
    }
    }
    add_action( 'user_register', 'gamipress_affwp_referral_signup' );

    Has something to do with their “$affiliate_id = affiliate_wp()->tracking->get_affiliate_id();” not sure if that’s the same as SliceWP parent or linked customer?

    I have the regular get affiliate ID in there already but something wasn’t working.

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    Hmm… I believe their first line of code is grabbing the ID of the affiliate that referred the visit, the one that is tracked via the cookie.

    If that’s the case, I recommend using this function in SliceWP’s case: slicewp_get_referrer_affiliate_id()

    The function will return either null, if the visit isn’t tracked, or an integer representing the ID of the affiliate that referred the visit, which is stored in the browser’s cookie.

    Not sure if this is the functionality you need, but please try it out.

    Thank you and best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    function gamipress_cslicewp_referral_signup( $user_id ) {
    
    $affiliate_id = slicewp_get_referrer_affiliate_id();
    
    // If new registered user has come from an affiliate, then trigger it
    if( $affiliate_id ) {
    
        // Get user id from affiliate id
    
        $affiliate_user_id = slicewp_get_affiliate( $affiliate_id );
    
        // Trigger referral sign up event to award the affiliate that gets the new user
        do_action( 'gamipress_cslicewp_referral_signup', $affiliate_id, $affiliate_user_id, $user_id );
    
        // Trigger become an user through an affiliate event to award the referral that becomes as a new user
        do_action( 'gamipress_cslicewp_register_referral', $affiliate_id, $user_id, $affiliate_user_id );
    
    }
    }
    add_action( 'user_register', 'gamipress_cslicewp_referral_signup' );

    Interestingly, the second trigger works.

    If a user signs up with affiliate code then they get the reward.

    But the first part, to reward the affiliate, still does not work. Perhaps because I made it so members only become affiliates using a gravityforms form? Not at registration?

    Got 50% ??

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    Happy to hear the trigger worked. As for the first part, I’m afraid that I cannot say why it didn’t work.

    You can try to remove the custom code I’ve sent you, the one for Gravity Forms, and check to see if without it the trigger works or not. This could elude if the problem is here or somewhere else.

    Best wishes,

    Mihai

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Hooking SliceWP into GamiPress Triggers?’ is closed to new replies.