Topic: Amazon associates links

Most of the webmasters are using the amazon associates programm to earn some cash. But when users are posting links to an amazon product the associate-id is missing and the admin has to put it there manually.

It would be nice if the parser could recognize amazon links and puts the associate-id in (saved somewhere in the admin options). It should also be able to see if an associate-id is used which isn't set in the preferences and changes it to the correct one.

Perhaps an option for version 1.3?

2

Re: Amazon associates links

I am quite sure this will not be part of 1.3. as it contradicts the PunBB mantra (you know, being slim and fast and without options tat not everybody needs...)
But I think it can be done quite easily in the parser, it's just that I don't have a link at hand.

SO, as an example, you could add this to the handle_url function in parser.php.
Right after

    else if (!preg_match('#^([a-z0-9]{3,6})://#', $url, $bah))     // Else if it doesn't start with abcdef://, we add http://
        $full_url = 'http://'.$full_url;

you put

  if(ereg("amazon\.[com|de|co\.uk]", $full_url))  {
    if(!ereg_replace("link_id=[0-9|a-z]","link_id=".$pun_config['MYLINKID'],$full_url)) {
      $full_url .= "&link_id=".$pun_config['MYLINKID'];
      }
    }

Now, all you have to do is:
- Check if my syntax for the associate ID is OK wink
- Get the variable MYLINKID into $pun_config

The quick and dirty way to do this is to add it into the PUNPREFIXconfig table manually.

The German PunBB Site:
PunBB-forum.de