PDA

View Full Version : How to embed/add php code into vBulletin forum



Fli
02-01-2018, 10:53 PM
You want to add some advertisement or other way execute PHP code on vbulletin forum.

option A) You can do that on Homepage only, inside sidebar. vBulletin Admin area / Forums & Moderators / Forum Blocks Manager
As a block content type, you can select PHP and insde content, you can add PHP code or if you need to add some advertisement, you can add this:


if (strpos($_SERVER['HTTP_USER_AGENT'],'Google') == false || strpos($_SERVER['HTTP_USER_AGENT'],'Bing') == false || strpos($_SERVER['HTTP_USER_AGENT'],'Microsoft') == false) {
$html = '

Some html advertisement here that should not appear for google, bing, microsoft bots

';
return $html;
}

option B) vBulletin Admin area / Plugins & Products / Add New Plugin
As a Hook location you can use navbits_complete and it should load the php code on all pages of the forum including index. To show it only on thread pages, use "fetch_foruminfo"
Plugin is Active = yes
As a PHP code, do NOT enter <?php ?>, you should add code right away