Page 1 of 1

Questions about writing a plugin

Posted: 02 Apr 2010, 20:32
by triplethreat401
Hi,

I'm just getting used to writing a plugin for v1.2, and I have a few questions concerning a few functions I would like to take advantage of.

The references I referred to are here:
http://www.mantisbt.org/wiki/doku.php/m ... s_overview

Issue A:
Can someone clarify how I really can connect and manipulate values to the database? I want to create and modify my own table in the existing mantis database, but I don't understand how to properly do it.

Issue B:
If issue A fails (well, either way), how can I stake advantage of the plugin callback functions (e.g. the install(), upgrade(), uninstall(), etc...)? I want to create a database when someone installs (or else I might have to do it the "poor-man's way") and remove the table when someone uninstalls it.

Examples would probably help me out big time here, because my main problem is that I cannot find any plugins out there that utilizes the install and uninstall function and manipulates the database using mantis' built-in commands. Thanks in advanced!

Re: Questions about writing a plugin

Posted: 03 Apr 2010, 07:22
by atrol
Examples can be found at http://git.mantisforge.org

One plugin which creates it's own database table is
http://git.mantisforge.org/w/snippets.g ... ts;hb=HEAD
Have a look at public function schema

Re: Questions about writing a plugin

Posted: 20 Apr 2010, 21:46
by ha17
I'm writing in my first plugins for Mantis. What is the preferred way to query the database? I'm familiar with how other plugin systems such as Wordpress' and Dokuwiki's though with Dokuwiki I wasn't querying a database. Can someone point to a function or something, even if undocumented I can grep it out of the codebase. I'm actually looking to writing more template-type things than plugins; for instance to display status reports and bug entry pages that differ from the standard interface. Thanks.

Re: Questions about writing a plugin

Posted: 21 Apr 2010, 07:42
by atrol
ha17 wrote:What is the preferred way to query the database?
MantisBT uses ADOdb to access database
ha17 wrote:Can someone point to a function or something, even if undocumented I can grep it out of the codebase. for instance to display status reports and bug entry pages that differ from the standard interface
You should start examining how standard interface works.
Have a look at bug_report_page.php and summary_page.php.