PDA

View Full Version : Insert PHP code in Style Manager


zero477
03-08-2012, 12:06 AM
Hello all,

I divided the forum in two columns using the Style Manager.

http://www.hyperlinkbuilding.org/seoforum.php

In the right column (where you can see some adds now), I want to display some info related to the user. So I need to insert some PHP code there. When I do it, the PHP code is displayed like a comment.


Greetings,
Eddie

--------------- Added 1331170301 at 1331170301 ---------------

Hello all,

I read in the manual the following:

Using PHP Functions in Template Conditionals
As a security precaution, to prevent malicious damage to either your database or your server itself, most PHP functions are disallowed in template conditionals.

This, for example, would be disallowed by the vBulletin template system, as it contains a call to a 'forbidden' function: mysql_query.
<vb:if condition="$my_variable = mysql_query('SELECT * FROM mytable')">
<!-- naughty naughty... -->
</vb:if>
At the time of writing, the list of allowed 'safe' functions is as follows:


Therefore .... How can we use mysql_query function?? is there an alternative way??? I am trying to adapt vbulltin to an old website with many tables and info... I need to use that function..

Someone knows what to do??

kh99
03-08-2012, 08:34 PM
You need to create a plugin for your php code, create a new php file, or else edit one of the vbulletin files. It's preferable to use a plugin if possible since if you edit any vbulletin files you will need to make the changes again when you upgrade.

You can read about how to create a plugin in the manual, but you also need to find a hook location that lets you do what you want. You can do that by looking at the vbulletin code to fine the calls to fetch_hook(), or you can ask here and someone might be able to tell you.