vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - Dynamic Amazon Links (https://vborg.vbsupport.ru/showthread.php?t=163393)

djbaxter 01-22-2008 10:40 PM

Quote:

Originally Posted by ChrisSy (Post 1426816)
Anyone got the code hacks to swap out .de for co.uk?

More importantly, working code? I don't know why this isn't simple but evidently the simple solutions don't work.

MotMann 01-28-2008 09:53 PM

I use the older version, but 17 items will not be in the affilistatus in amazon.de. There are over 160 € missing :(

My ID Code is correct. I Think, there is a Problem, that the ID comes on the end of the URL?

redlabour 01-29-2008 04:46 PM

Does it work with 3.7 ?

pete_brady 02-06-2008 04:06 PM

Quote:

Originally Posted by redlabour (Post 1431818)
Does it work with 3.7 ?

working fine for me on 3.7b4

still hoping for .co.uk

Dabbi 02-10-2008 11:17 PM

Please excuse what may seem like a stupid request... Would someone please tell me which program I can both open AND save "functions_amazon_links.php" so I can modify it as required and still have it as a php?

I've found programs that will open it such as MS Word, Notebook, MS Publisher but for the life of me I'm not seeing how I can save it as a php. :o

Although this seems like a great mod I can't install it until I can get this part done so any help would be appreciated... thanks. :)

djbaxter 02-10-2008 11:25 PM

Quote:

Originally Posted by Dabbi (Post 1440434)
Please excuse what may seem like a stupid request... Would someone please tell me which program I can both open AND save "functions_amazon_links.php" so I can modify it as required and still have it as a php?

I've found programs that will open it such as MS Word, Notebook, MS Publisher but for the life of me I'm not seeing how I can save it as a php. :o

Although this seems like a great mod I can't install it until I can get this part done so any help would be appreciated... thanks. :)

Download Crimson Editor (freeware). An excellent editor with code highlighting, etc., to help you find missing brackets, closing tags, end quotes, etc.

Dabbi 02-11-2008 12:50 AM

Thank you! That worked beautifully and I truly appreciate the help. :)

Sergioh 03-06-2008 04:15 AM

How do I fully uninstall this? I deleted the plugin and deleted the php file and it's still showing the amazon icon.

nMIK-3 03-26-2008 06:07 AM

Installed succesfully but how do I know that is working?

MetalAges 04-04-2008 03:10 AM

Doesn't seem to work for me, using 3.6.8 with VBSEO. I recall on some other plugins I had to add the line: rel="novbseo" to URL code. Maybe the same with this?

felxi 04-08-2008 06:31 AM

hey!

vbulletin stores the posts in the database and uses a cache (table: postparsed). To clear the cached old/new urls you have truncate this table.

this means... no cached postes will only be overwritten in the postparsed table. the original post is not overwritten (table: post).

after installing only new posts will be overwritten, but you can truncate the postparsed table as explained.

i hope this helps.

RobParker 04-19-2008 02:37 PM

Has anyone got this working with .co.uk yet?

GoodKarmaKid 05-10-2008 06:04 AM

Does this work with 3.70 gold?? This is exactly what I'm looking for.

Jason

pete_brady 05-25-2008 06:11 AM

Quote:

Originally Posted by RobParker (Post 1494505)
Has anyone got this working with .co.uk yet?

bump

Quote:

Originally Posted by GoodKarmaKid (Post 1514617)
Does this work with 3.70 gold?? This is exactly what I'm looking for.

Jason

yep working just fine

Phillip Chapman 06-02-2008 01:48 AM

Can someone confirm whether or not this works with 3.6.10? Should my associates id be visible in the actual amazon URL if working properly?

Phillip Chapman 06-02-2008 02:31 AM

It's working now. We noticed the links don't change in preview, only when a message has been posted.

buro9 06-05-2008 09:46 AM

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.

pete_brady 06-05-2008 10:35 AM

i think i love you

edit: hmm i must be doing something wrong

pete_brady 06-05-2008 05:49 PM

ok did some more tests.

the hack works when i post a raw link, but not when i post it like so.

Previously it worked both ways. Not that i'm complaining, though!

ArnyVee 08-22-2008 01:05 AM

Is this mod still functioning alright for folks? Since there hadn't been a post in nearly three months, I wanted to ensure that everyone was okay before proceeding. :)

Dabbi 08-25-2008 10:13 PM

Yes, FWIW this still seems to be working just fine on my board (3.7). :)

ArnyVee 08-29-2008 11:07 AM

Does what it is meant to do on my boards as well (3.7.1)! :D

Hidden_Gamma 09-12-2008 01:15 PM

I've just installed this on a 3.7.3 PL1 board and it is not adding my ID to any Amazon links. Is it supposed to work in that version of vBulletin?

TMR Bac 09-17-2008 03:19 PM

I must be missing something here. What else do you had to do other than upload functions_amazon_links.php into the includes folder to get this to work?

pete_brady 09-24-2008 08:19 PM

Quote:

Originally Posted by Hidden_Gamma (Post 1620514)
I've just installed this on a 3.7.3 PL1 board and it is not adding my ID to any Amazon links. Is it supposed to work in that version of vBulletin?

had been working great but has now stopped working for me, possibly since the 3.7.3 pl1 install

Hidden_Gamma 09-24-2008 08:48 PM

Quote:

Originally Posted by pete_brady (Post 1629523)
had been working great but has now stopped working for me, possibly since the 3.7.3 pl1 install

I've just realised that it seems to not work on Amazon links that are already posted, for some reason, only on new ones added since I installed the plug-in. I have a thread with links to Blu-ray titles listed on Amazon and I had to go through the entire thread and re-edit the links to get the plug-in to add the affiliate tag to them when clicked on. The URL's are identical, but, there you have it. :confused:

Michael2 10-25-2008 06:06 PM

Just added it and seems to work great, thanks!

wraggster 11-16-2008 02:10 PM

i have this or one of the others installed on my forums and works great, sadly when i use vbexternal to pull the data from the forums into a newsfeed (so it shows up on my websites) it doesnt add my associate links, is there any code i can stick on my website or in the news.php which will change links to my associate link

dvsDave 11-26-2008 03:05 AM

Works great on vBulletin 3.7.4 PL1 and VBSEO 3.2.0

just wanted to post a heads up on that and a thanks for the mod, works wonderfully!

heatherw610 12-09-2008 12:29 AM

Does this work for 3.7.4?

Hidden_Gamma 12-25-2008 02:39 AM

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? :confused: :o

rmd1 12-26-2008 01:06 PM

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 (Post 1693267)
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? :confused: :o

try out the code that was posted a page ago. that one worked for me with co.uk

Hidden_Gamma 12-26-2008 05:32 PM

Quote:

Originally Posted by rmd1 (Post 1694010)

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. :confused:

Ironduke 01-02-2009 12:16 AM

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?

Hidden_Gamma 01-11-2009 09:30 PM

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. :o

ebed146 01-17-2009 03:07 AM

Someone port this over to 3.8 please. It is a wonderful hack!

Claygp 01-22-2009 03:49 AM

Are we going to see a 3.8 version??

veracity024 01-28-2009 06:23 PM

the sooner the better for the 3.8 version!

Coop1979 02-07-2009 03:16 AM

I just PM'd the coder. I offered financial compensation to update the mod, so hopefully that will help!

Hidden_Gamma 03-19-2009 05:57 PM

Quote:

Originally Posted by buro9 (Post 1541380)
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.


All times are GMT. The time now is 01:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01768 seconds
  • Memory Usage 1,962KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete