• Resolved duffldofflo

    (@duffldofflo)


    Hello there, thank you for this high quality plugin!

    My client would like the referral link without slug or parameter:

    At the moment it looks like this: abcd.com/partner/mrsmith (“long” url)

    He would like: abcd.com/mrsmith (“short” url)

    At the moment we achieve that by redirecting every referral url from the “one without /partner/ to the one withou”short” one to the “long” one by using a redirection plugin. This works very well, however we can not automate this because the affiliate will not see the “short” url in his dashboard, only the “long” one and affiliates may not understand this.

    Is there any way to achieve the “short” url in SliceWP? 🙂

    Thank you in advance and regards!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @duffldofflo,

    Thank you for reaching out! You could use this particular code snippet to strip out the “/partner” part from the referral URLs.

    function slicewp_custom_get_affiliate_url( $url ) {

    $url = str_replace( '/partner', '', $url );

    return $url;

    }
    add_filter( 'slicewp_get_affiliate_url', 'slicewp_custom_get_affiliate_url' );

    The “slicewp_get_affiliate_url” filter is used in the “slicewp_get_affiliate_url()” function and you can use it to modify the affiliate’s referral URL.

    Even so, please note that the hook’s intent is to add additional parameters, not remove them. However, considering that you’re using a redirection plugin to redirect to the correct referral URL, the above solution should work nicely.

    Thank you and best wishes,

    Mihai

    • This reply was modified 1 year, 3 months ago by iova.mihai.
    Thread Starter duffldofflo

    (@duffldofflo)

    Hi Mihai,

    wow, thank you!
    I tested it, and it works perfectly!

    Do I understand correctly: This snippet removes the /partner part from the URL that is shown in the settings (e.g. where the affiliate can copy his url / see his QR code) – but the actually working referral URL will still have to be with the /partner part as this is technically necessary – right?

    So I need to take care of creating a redirection from “short URL” to “long URL” else it wont work – just as I am doing right now, and this works well.

    But I have been creating the redirections manually, so now I want to automate the creation of the redirections. I have a snippet that will append the redirection directives at the end of my .htaccess file.
    I now just need a hook with which to start the snippet execution.

    Is there a hook in SliceWP that I can use?
    Like “affiliate created” or “affiliate edited” or “affiliate deleted” (the latter I would use to find and delete the according redirection in the .htaccess file).

    Thank you and regards

    Thomas

    • This reply was modified 1 year, 2 months ago by duffldofflo.
    • This reply was modified 1 year, 2 months ago by duffldofflo. Reason: I forgot a part of my question
    Plugin Author iova.mihai

    (@iovamihai)

    Hey @duffldofflo,

    Yep, you’ve got everything right. And yes, we do have action hooks for what you need. These are: slicewp_insert_affiliate, slicewp_update_affiliate, slicewp_delete_affiliate

    All three actions will pass the affiliate’s unique ID as the first parameter.

    Thank you and best wishes,

    Mihai

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Referral link without slug / parameter possible?’ is closed to new replies.