TheWebJunkie
Mar 31st 2005, 2:29 am
Hope you all like this hack for vbulletin :D
My paypal is thewebjunkie@gmail.com if you would like to make a small donation :)
Add a User Profile Field with these settings:
Profile Field Type: Single-Line Text Box
Title: (your choice)
Description: (your choice)
Field Editable By User: Yes
Private Field: Yes
Field Searchable On Memers List: No
Show On Members List: No
(I have only specified settings for the fields you will need to change from their defaults.)
In the php_include_start template, add this code:
srand();
$random_number = rand(0, 1);
$ga_adsenseid = 'ENTER_YOUR_ADSENSE_ID_HERE';
if ($random_number == 1)
{
if (THIS_SCRIPT == 'showthread')
{
if (!empty($_REQUEST['t']))
{
$ga_threadid = $_REQUEST['t'];
}
else
{
$ga_threadid = $_REQUEST['threadid'];
}
$ga_thread = $DB_site->query_first("
SELECT postuserid
FROM ".TABLE_PREFIX."thread
WHERE threadid = $ga_threadid
");
$ga_user = $DB_site->query_first("
SELECT field7 AS adsenseid
FROM userfield
WHERE userid = $ga_thread[postuserid]
");
}
elseif (THIS_SCRIPT == 'showpost')
{
if (!empty($_REQUEST['p']))
{
$ga_postid = $_REQUEST['p'];
}
else
{
$ga_postid = $_REQUEST['postid'];
}
$ga_post = $DB_site->query_first("
SELECT userid
FROM ".TABLE_PREFIX."thread
WHERE postid = $ga_postid
");
$ga_user = $DB_site->query_first("
SELECT field7 AS adsenseid
FROM userfield
WHERE userid = $ga_post[userid]
");
}
if (!empty($ga_user['adsenseid']))
{
$ga_adsensecode = $gauser['adsenseid'];
}
}
Then, whereever you have your AdSense display code, find the spot where you specify your AdSense ID and replace it with $ga_adsenseid . Also make sure in the above code that you enter YOUR AdSense ID in the spot above where it says "ENTER_YOUR_ADSENSE_ID_HERE".
My paypal is thewebjunkie@gmail.com if you would like to make a small donation :)
Add a User Profile Field with these settings:
Profile Field Type: Single-Line Text Box
Title: (your choice)
Description: (your choice)
Field Editable By User: Yes
Private Field: Yes
Field Searchable On Memers List: No
Show On Members List: No
(I have only specified settings for the fields you will need to change from their defaults.)
In the php_include_start template, add this code:
srand();
$random_number = rand(0, 1);
$ga_adsenseid = 'ENTER_YOUR_ADSENSE_ID_HERE';
if ($random_number == 1)
{
if (THIS_SCRIPT == 'showthread')
{
if (!empty($_REQUEST['t']))
{
$ga_threadid = $_REQUEST['t'];
}
else
{
$ga_threadid = $_REQUEST['threadid'];
}
$ga_thread = $DB_site->query_first("
SELECT postuserid
FROM ".TABLE_PREFIX."thread
WHERE threadid = $ga_threadid
");
$ga_user = $DB_site->query_first("
SELECT field7 AS adsenseid
FROM userfield
WHERE userid = $ga_thread[postuserid]
");
}
elseif (THIS_SCRIPT == 'showpost')
{
if (!empty($_REQUEST['p']))
{
$ga_postid = $_REQUEST['p'];
}
else
{
$ga_postid = $_REQUEST['postid'];
}
$ga_post = $DB_site->query_first("
SELECT userid
FROM ".TABLE_PREFIX."thread
WHERE postid = $ga_postid
");
$ga_user = $DB_site->query_first("
SELECT field7 AS adsenseid
FROM userfield
WHERE userid = $ga_post[userid]
");
}
if (!empty($ga_user['adsenseid']))
{
$ga_adsensecode = $gauser['adsenseid'];
}
}
Then, whereever you have your AdSense display code, find the spot where you specify your AdSense ID and replace it with $ga_adsenseid . Also make sure in the above code that you enter YOUR AdSense ID in the spot above where it says "ENTER_YOUR_ADSENSE_ID_HERE".