Read out ref-cookie?

Hi George,

first of all, I again want to thank you for your last help. It brought me to the right track.

Now I got another challenge, for which I need some hints: I want to read out the referring affiliate name to my custom login/registering form of my site. I checked the cookies, which are set, when visiting the login/registering page with an affiliate ref-link, but I didn’t find any affiliate-cookie, where I would be able to read out the affiliate-ID to be able to make a database request for the corresponding affiliate-name.

Also the shortcode [referrer display] only seems to work, when the respective referral is logged in.

I would be grateful, if you could tell me, where can I find the ref-info, which is stored by the ref-link when visiting the site. Or is there another shortcode or hook/filter, which I can use?

Thank you very much for your fast help in advance.

Best wishes,
Martin

6 Responses to Read out ref-cookie?

  1. Eugen Bleck May 7, 2020 at 8:16 pm #

    Hi Martin,

    I trust you are safe and doing awesome! Thank you for being patient.

    A simple use case for this filter would look like this:

    function xyz_filter( $affiliate_id, $service ) {
    return $affiliate_id;
    }
    add_filter( ‘affiliates_service_affiliate_id’, ‘xyz_filter’, 10, 2 );

    I would also suggest you have a look at this resource:
    https://developer.wordpress.org/reference/functions/add_filter/

    With respect to your Users’ disappearing and getting deleted, I’m currently looking into the possible causes and would respond to it via the other topic you posted.

    Once more I must thank you for your patience and for using Affiliates and its extensions.

    I wish you a great day ahead and look forward to helping you figure out why the users are being deleted.

    Kindest regards,
    Eugen.

    • Martin Bohnhorst May 12, 2020 at 6:13 pm #

      Hi Eugen,

      sorry for my late reply. I am really challenged by this project. Thank you for your example. I managed to reach my goal by creating a custom function in functions.php of my theme and read out the results via shortcode. Works perfectly, thank you 🙂

      But I got another challenge: I have got 9 levels in multi-tier and I want to read out the number of affiliates en each level for a respective user. So let’s say User A has got User B in first line. User B has got User C and User D in first line, User D got User E and User F and User G in first line etc…, so the count for User A should be like:

      User A:

      Number of Firstliners: 1
      Number of Secondliners: 2
      Number of Thirdliners: 2
      etc…

      Got any idea for me?
      Thank you very much in advance.

      Best,
      Martin

      • Martin Bohnhorst May 12, 2020 at 6:14 pm #

        Sorry, mistake:

        Number of Thirdliners: 3 (not 2)

  2. Martin Bohnhorst May 6, 2020 at 6:37 pm #

    Hi Eugen,

    faster then expected, can you give me a short example how to use these filters?
    Can you give me an short example on how to apply, let’s say: affiliates_service_affiliate_id

    This would help me a lot.

    Thank you very much in advance.

    Best,
    Martin

  3. Eugen Bleck May 6, 2020 at 4:20 pm #

    Hi Martin!

    I trust you are doing great and thanks for using our plugins.

    The affiliate cookie is wp_affiliates.

    Yes, the [referrer display] only works that way because the shortcode is used to indicate information about the referrer. And the display attribute is used to decide what attribute gets displayed.

    To return the referring affiliate’s ID. This hook affiliates_service_affiliate_id would be your goto hook.

    After fetching the affiliate_id it is also useful to check if this is from an existing affiliate with function-affiliates_check_affiliate_id.

    Thanks again for being a valued customer of Affiliates plugin and its extensions.

    Have an awesome and very productive day ahead.

    🙂 George sends his regards.

    Warm regards.
    Eugen.

    • Martin Bohnhorst May 6, 2020 at 5:39 pm #

      Hi Eugen!

      Thanks a lot for your fast and professional help on this.

      Yes, I like the affiliates plugin because it is so customizable and offers a great variety of hooks, filters and shortcodes. That’s your outstanding advantage. Cool work.

      Ok, so I will use the hook you recommended. If there might be any issue on this, which I cannot solve, I will reply to this post, ok?

      But I have got another issue, my wordpress users are regularly and unexplainably disappearing from my WordPress Database and in the Affiliate Database-Table they are set on “deleted” and I simply cannot figure out why. But for this I will write a new post and would be very glad if you might also have a professional hint for me.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share