Pretty Link Lite
[resolved] Possible to attach a group to an affiliate link? (4 posts)

  1. Stefan Nilsson
    Posted 3 years ago #

    When getting approved for a site on an affiliate network you get a link like this:


    Then you add the product URL at the end:


    Resulting in the following URL:


    I'm wondering if it's possible to somehow attach the first URL to a group? Or maybe a similar solution so I only have to add the store URL when creating a new link. By doing so I don't have to locate the first half of the URL every time I add a new link and I can update it when changing affiliate network without having to edit all of my stored links.


  2. Stefan Nilsson
    Posted 3 years ago #

    I've gone through how Pretty Link works and the simple method would be to add the affiliate network URL as a description for the group.

    Group (name, description):
    - TradeDoubler | http://clk.tradedoubler.com/click?p=23&a=234234&url=

    Link (target URL):
    - http://store.com/true_blood_-_season_5_(5_disc)

    Then in the redirect you simply add these two:

    $link = $group_desc . $link_targetURL;

    Unfortunately I'm not able to find where the redirect function is. Could someone point me in the right direction?

  3. Stefan Nilsson
    Posted 3 years ago #

    Managed to solve it.

    In classes/models/PrliUtils.php I replaced row 335 & 336:

    header("HTTP/1.1 307 Temporary Redirect");
              header('Location: '.$pretty_link_url.$param_string);


    if(isset($pretty_link->group_id) && $pretty_link->group_id != 0){
                  // Fetch group URL from group description
                  $query = 'SELECT gr.* FROM ' . $wpdb->prefix . 'prli_groups gr WHERE id=' . $pretty_link->group_id;
                  $group_data = $wpdb->get_row($query);
                  $group_url = $group_data->description;
                  header("HTTP/1.1 307 Temporary Redirect");
                  header('Location: '.$group_url.$pretty_link_url.$param_string);
                } else {
                  header("HTTP/1.1 307 Temporary Redirect");
                  header('Location: '.$pretty_link_url.$param_string);

    Depending on your use you might want to make some changes but now you know where to start if you want the same functions in your plugin.

  4. cartpauj
    Plugin Author

    Posted 3 years ago #

    Interesting solution. Thanks for sharing!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.