Goran Jurić

Blank page after a quick reply (vBulletin)

Published on

While launching the Google Adsense on Gameplay and its forum (vBulletin 3.8) we ran into a strange issue while posting quick reply messages to the forum with Firefox. After hitting submit the page turned blank although the comment was apparently posted.

We have integrated our Adsense code into the postbit vBulletin template after the last post on the page using this syntax:

<if condition="$post['islastshown']">
     Adsense code here.

The problem happend because Quick Reply uses asynchronous javascript to submit the reply and render the new reply at the and of the page. Since we are embedding the Adsense code if the post is “last shown” this renderd the Google Adsense code twice and FF “broke”.

The fix is quite simple, you just have to check if the post is being sent as a response to the asynchronous request, so the new and working code looks like this:

<if condition="$post['islastshown'] AND !$GLOBALS['vbulletin']->GPC['ajax']">
    Adsense code here.

Of course this is not the only case which causes vBulletin forum to render a blank page. For a list of other possible reasons take a look at this chapter in the  official documentation.

If you are interested you can also take a look at this exhaustive list of conditionals which you can use in your vBulletin templates.