Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Dynamic Amazon Links Details »»
Dynamic Amazon Links
Version: 1.05, by felxi felxi is offline
Developer Last Online: Dec 2010 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.6.x Rating:
Released: 11-21-2007 Last Update: 11-24-2007 Installs: 92
Uses Plugins
Additional Files Is in Beta Stage  
No support by the author.

Description
This Hack will easily rewrite all amazon links whitin the posts to your associate id. You can add your amazon.de and amazon.com associate id, links to both amazon stores will be replaced with the right id, it works fine with multilanguage boards.

vBulletin
vB 3.6.x working
vB 3.5.x working

updating
just upload the functions_amazon_links.php from the zip and don't forget to insert your amazon ids.

Change Log
25/11/2007 v1.05
- support for [ url=xxx]yyy[ /url]
- replacement for tag=xxx and ref=xxx in non asin links
- small fix for /preview/ links

24/11/2007 v1.04
- [url]amazon-link[ /url] long amazon links will be shorten vb like

23/11/2007 v1.03
- [url] and [url="xxx"] will be repleaced

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
markoroots

Comments
  #72  
Old 12-25-2008, 02:39 AM
Hidden_Gamma Hidden_Gamma is offline
 
Join Date: Sep 2008
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This doesn't seem to be working for me in 3.7.4, and I've tried the hack to get Amazon UK links added, and those won't work either. Maybe I'm doing something wrong?
Reply With Quote
  #73  
Old 12-26-2008, 01:06 PM
rmd1 rmd1 is offline
 
Join Date: Dec 2008
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey, I installed the script and its working so far... but when editing a post and clicking on the submit button it turns into the loading symbol for infinite time... but the post already got edited. I contacted the the vB support and they told me its because of this hack
Can somebody confirm that he is having the same problems? Or a fix for this? Please help, I need this working asap!

Regards,
rmd1

Quote:
Originally Posted by Hidden_Gamma View Post
This doesn't seem to be working for me in 3.7.4, and I've tried the hack to get Amazon UK links added, and those won't work either. Maybe I'm doing something wrong?
try out the code that was posted a page ago. that one worked for me with co.uk
Reply With Quote
  #74  
Old 12-26-2008, 05:32 PM
Hidden_Gamma Hidden_Gamma is offline
 
Join Date: Sep 2008
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rmd1 View Post

try out the code that was posted a page ago. that one worked for me with co.uk
That's what I tried, but it doesn't work. In fact, nothing works. It just won't add the affiliate links to anything.
Reply With Quote
  #75  
Old 01-02-2009, 12:16 AM
Ironduke Ironduke is offline
 
Join Date: Dec 2006
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've uploaded the PHP file with my aStore ID written in, and uploaded the plugin. How do I get it to re-write the links to include my aStore ID?
Reply With Quote
  #76  
Old 01-11-2009, 09:30 PM
Hidden_Gamma Hidden_Gamma is offline
 
Join Date: Sep 2008
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, this wasn't working for me in 3.7.4 PL1, and now I've gone to 3.8.0 -- do I have any hope of getting it to work in that version?

Also, I have one further question about the hack on the last page to get it to work with Amazon.co.uk, what exactly do you mean by 'add the bit in the preg_match to work with this'? I'd like to give it one last go before I throw my hands up on this entirely.
Reply With Quote
  #77  
Old 01-17-2009, 03:07 AM
ebed146 ebed146 is offline
 
Join Date: Dec 2008
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Someone port this over to 3.8 please. It is a wonderful hack!
Reply With Quote
  #78  
Old 01-22-2009, 03:49 AM
Claygp's Avatar
Claygp Claygp is offline
 
Join Date: Mar 2005
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are we going to see a 3.8 version??
Reply With Quote
  #79  
Old 01-28-2009, 06:23 PM
veracity024 veracity024 is offline
 
Join Date: Jan 2009
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the sooner the better for the 3.8 version!
Reply With Quote
  #80  
Old 02-07-2009, 03:16 AM
Coop1979 Coop1979 is offline
 
Join Date: Aug 2006
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just PM'd the coder. I offered financial compensation to update the mod, so hopefully that will help!
Reply With Quote
  #81  
Old 03-19-2009, 05:57 PM
Hidden_Gamma Hidden_Gamma is offline
 
Join Date: Sep 2008
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by buro9 View Post
I've got this working for .co.uk

You can easily add .ca, .de or any two level .tld like .co.uk to this by adding:
$associate_id_ and then the .tld with the . replaced by _
$associate_id_co_uk is the UK one.

And of course add the bit in the preg_match to work with this.

Code for the file is thus:
PHP Code:
<?php
function amazon_links($text) {
    
$associate_id_co_uk 'buro9-21'// or leave empty
    
$associate_id_com 'buro9-20'// or leave empty

    
$replace_targt_urls true// true or false

    
$replace_src = array();
    
$replace_str = array();

    
// check for [url="amazon-link"]some text[/url]
    
if(preg_match_all("/\[url\=(?:\")?(http:\/\/(?:[A-z0-9\.]+)?amazon\.(co\.uk|com)\/(?:.+))(?:\")?](.+)\[\/url\]/iU"$text$out)) {
        for(
$i=0;$i<count($out[1]);$i++) {
            
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
            
$out[4][$i] = $out[1][$i];

            if(
$associate_id && !empty($associate_id)) {
                
// Look for an asin number
                
if(preg_match("/\/[A-Z0-9]{10}(\/)?/"$out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
                    if(
substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
                    
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
                } else {
                    
$target_url $out[1][$i];
                    if(
$replace_targt_urls) {
                        
$target_url preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU''ref='.$associate_id$target_url);
                        
$target_url preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU''tag='.$associate_id$target_url);
                    }

                    
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
                }

                
$replace_src[] = '[url="'.$out[4][$i].'"]';
                
$replace_str[] = '[url="'.$out[1][$i].'"]';

                
$replace_src[] = '[url='.$out[4][$i].']';
                
$replace_str[] = '[url='.$out[1][$i].']';

                
$replace_src[] = '[url="'.$out[4][$i].'"]';
                
$replace_str[] = '[url="'.$out[1][$i].'"]';

                
$replace_src[] = '[url='.$out[4][$i].']';
                
$replace_str[] = '[url='.$out[1][$i].']';
            }
        }
    } unset(
$out);
    
    
// check for [url]amazon-link[/url]
    
if(preg_match_all("/\[url\](http:\/\/(?:[A-z0-9\.]+)?amazon\.(co\.uk|com)\/(?:.+))\[\/url\]/iU"$text$out)) {
        for(
$i=0;$i<count($out[1]);$i++) {
            
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
            
$out[4][$i] = $out[1][$i];

            if(
$associate_id && !empty($associate_id)) {
                
// Look for an asin number
                
if(preg_match("/\/[A-Z0-9]{10}(\/)?/"$out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
                    if(
substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
                    
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
                } else {
                    
$target_url $out[1][$i];
                    if(
$replace_targt_urls) {
                        
$target_url preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU''ref='.$associate_id$target_url);
                        
$target_url preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU''tag='.$associate_id$target_url);
                    }

                    
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
                }

                
$displayed_link $out[4][$i];
                if(
strlen($displayed_link) > 55) {
                    
$displayed_link substr($displayed_link036).'...'.substr($displayed_link, -14);
                }


                
$replace_src[] = '[url]'.$out[4][$i].'[/url]';
                
$replace_str[] = '[url="'.$out[1][$i].'"]'.$displayed_link."[/url]";

                
$replace_src[] = '[url]'.$out[4][$i].'[/url]';
                
$replace_str[] = '[url="'.$out[1][$i].'"]'.$displayed_link."[/url]";
            }
        }
    } unset(
$out);


    
// replace the message
    
if(isset($replace_src[0])) {
        
$text str_replace($replace_src$replace_str$text);
    } unset(
$replace_src$replace_str);

    return 
$text;
}
?>
Thanks for the great hack.

Can someone tell me what exactly I am supposed to write into the preg_match section to get this hack to work for my multilevel domain affiliate links if I am using more than one? I have affiliate IDs for .co.uk and .co.jp, but I don't really understand how to write in more than one according to this example, I also can't seem to figure out where I am supposed to put my .de domain in the preg_match section.

Also, I seemed to have discoveed that on my forum (running 3.8.1 PL1) that this plugin will only add the affiliate ID to URLs if they are added raw, but if an Amazon URL is added to text, like this, for example: I Love Lucy, it won't add the Afilliate ID.

Thanks for any help. I really hope this plugin can be updated.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:01 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08172 seconds
  • Memory Usage 2,374KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete