PDA

View Full Version : How to add plugin options in control panel?


gushin
01-31-2012, 02:13 PM
Hi! Sorry for my bad English (I'm from Russia :)). I write plugin to my vbulletin forum, and in accordance with the statement of work I should add plugin options in control panel, like in this screenshot:
https://vborg.vbsupport.ru/external/2012/01/2.jpg

Please write in detail how can I do it? :confused:

Disasterpiece
01-31-2012, 02:24 PM
check out the cpnav*.xml files in includes/xml dir. This should give you a better idea.

gushin
01-31-2012, 02:36 PM
Ok. Thanks. I find xml file, where I can add my item in vbulletin options. Can I edit this file by the methods of vbulletin during installation my plugin? Or should I just edit this file?

kh99
01-31-2012, 02:50 PM
You should create a new xml file that starts with cpnav_, like cpnav_somemod.xml. If you put it in that directory vb will find it and your option menu will show up. You can control where it shows up by setting the displayorder attribute.

gushin
01-31-2012, 03:09 PM
Everything is clear now, thanks a lot!

--------------- Added 1328102730 at 1328102730 ---------------

Hi!) I have new question on this topic. When I trying to create a new xml file in "/includes/xml" dir, I faced the problem of determining the path to this folder.
I first try scan directory '/includes/xml' for the presence of file cpnav_myplugin.xml

$cpnav_dir = '/includes/xml';
$cpnav_files = scandir($cpnav_dir);

And scandir() return error. I think that the problem is on the path to the directory. Does vbulletine constant or a variable that contains the path to the root of your site?

--------------- Added 1328104959 at 1328104959 ---------------

solved the problem by using $_SERVER ['DOCUMENT_ROOT']