Adriano Chiaretta

How To add yahoo publisher network RSS ads to vbulletin feeds

took quite a while to figure this out, and since couldn’t find any solutions out there already, I figure to share my finding here.

This howto assumes that:

– you have a Yahoo! Publisher network (YPN) account (https://publisher.yahoo.com/)

– you have a vbulletin (http://www.vbulletin.com/) powered forum / online commmunity

– you want to monetize a bit over the RSS feed functionality provided by vbulletin.

You sure tried to get the google adsense for feeds, but though luck, the beta was already full — so you turned to YPN and figured to try there. You also happen to have vbulletin 3.6.x.

After a bit of messing around, it’s easy to realize that the right place where to inject the YPN RSS ads code is the file external.php — problem is, after vbulletin reworked external.php in recent updates, adding an xml class, it’s not that easy anymore to control the output. So here’s what you could do to get the job done quick:

1. disable XML feeds support from the vbulletin admin interface

2. get your RSS feed code from the YPN account (make sure to select the “wordpress” as platform), it will look like what below:

code removed here cause wordpress messes it up -- see snippet 1

3. disable also the RSS and RSS1 feed requests (anyway 99% of the RSS clients will understand RSS2 just fine). In externa.php (root of your vbulletin installation) go around line 140, you’ll see something like:

switch ($vbulletin->GPC['type'])

scroll down a bit and look for

case 'RSS':

and put an

exit;

right after that case.

Same for the very following case, (the RSS1)

4. now go all the way down to line 664, where you’ll see something like

case 'RSS2':

copy paste your YPN code and assign it to a variable, and then modify the relevant portions with the thread and post info of the current post, so that it becomes something like:

$yads = "code removed here cause wordpress messes it up -- see snippet 2"; 

7. replace the if … else statement right below it with this: 

  if ($vbulletin->GPC['fulldesc'])
     {
      $xml->add_tag('description', $plainmessage . $yads);
     }
     else
     {
      $xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview']) . $yads);
     }
 

8. comment out the if block right after what above, the one starting with: 

if (!$vbulletin->GPC['nohtml']) 

comment it all the way to the close brace. 

9. at this point you should be all set, save the file (perhaps with a different name just to be on the safe side) and check out the results of you work by visiting:

http://www.myvbulletinforum.com/external.php?type=RSS2

(note — depending on the cache lifespan you have set in your VB admin panel, it might take some time for the new content to display — change it temporarily to 1 minute to be able to quickly tweak external.php)

 

Hope this helps!

4 Comments

  1. Hello Everybody

    Just wanted to share my new experience.

    If your Windows XP fails to start due to an error related to lost HAL.DLL, invalid Boot.ini or any other important system boot files you can repair this by using the XP installation CD. Simply boot from your XP Setup CD and enter the Recovery Console. Then launch “attrib -H -R -S” on the C:\Boot.ini file and delete it. Run “Bootcfg /Rebuild” and then Fixboot

    Cheers,
    Carl

  2. Hi, just registered today, can someone give me some suggestions on which ebooks or guides are good for newbies like me?

Leave a Comment