This is just a tutorial to give you the really basic understanding of how MyPlaza Turbo/MyPlaza modules work.
Ok so now let's start the explanations part. (note that I've copied some information from the coments found in demo.php aswell as parts of the code)
Language
This functions contains all language variables (user part).
The $lang object, with these languages definitions will automatically be available in the following functions:
This function contains all language variables (admin part).
The $lang object, with these languages definitions will automatically be available in the following functions:
Admin CP part
Module information displayed in the Admin CP (Modules page).
Activates the module. Edit templates/Create tables/update database/add new fields into database tables here.
Deactivates the module. Remove template edits/delete database tables created here.
Module options page.
$process - true if processing options
User part
This function is executed whenever an item which links to this module is bought.
The item data is passed through $item so you can check the name, cost, etc. (It's an array)
Returns true if buy is successful, false otherwise
Creates a custom page for your module.
It's accessible from /plaza.php?action=page&p=mymod
This function is run before eval'ing htmlextra - use it to set variables appropriately.
Note: It is only run once - NOT one time for each item to be displayed!
If you want to learn more, check the demo module (demo.php) which came with every MyPlaza Turbo release. I learnt from there (when it still was for MyPlaza (1.2.x)), I have updated it to work with MyPlaza Turbo of course.
Ok so now let's start the explanations part. (note that I've copied some information from the coments found in demo.php aswell as parts of the code)
Language
PHP Code:
function mymod_lang()
{
global $mybb, $lang;
switch($mybb->settings['bblanguage'])
{
// stick your extra languages here, eg:
// case 'randomlanguage':
// $lang->hello = 'aslfkdjoiqwerpo';
// ...
// break;
// default to english
//case 'english':
default:
$lang->mymod_buy_tickets = 'Buy tickets';
$lang->mymod_buy_tickets_details = 'By buying tickets, you just lose money.';
}
}
The $lang object, with these languages definitions will automatically be available in the following functions:
- mymod_page()
- mymod_run()
- and in the plaza (for htmlextra eval'ing)
PHP Code:
function mymod_lang_admin()
{
global $mybb, $lang;
switch($mybb->settings['bblanguage'])
{
// add extra languages here
default:
$lang->mymod_name = 'MyModule Example';
$lang->mymod_description = 'MyModule example description.';
$lang->mymod_options = 'MyModule Options';
}
}
The $lang object, with these languages definitions will automatically be available in the following functions:
- mymod_activate()
- mymod_admin()
- mymod_info()
Admin CP part
PHP Code:
function mymod_info()
{
global $lang;
return array(
// MyPlaza will actually automatically use $lang->[modulename]_name and
// $lang->[modulename]_description if necessary, so the following two lines are actually optional
"name" => $lang->mymod_name,
"description" => $lang->mymod_description,
"website" => "http://yourwebsite.com/",
"author" => "Your name here",
"authorsite" => "http://authorwebsite.com/",
"version" => "1.0",
// strictly optional, but I recommend putting in a list of which versions
// of MyPlaza this module works under
"compatibility" => array(0.25,0.26)
);
}
PHP Code:
function mymod_activate()
PHP Code:
function mymod_deactivate()
PHP Code:
function mymod_admin($process)
$process - true if processing options
User part
PHP Code:
function mymod_run($item)
The item data is passed through $item so you can check the name, cost, etc. (It's an array)
Returns true if buy is successful, false otherwise
PHP Code:
function mymod_page()
It's accessible from /plaza.php?action=page&p=mymod
PHP Code:
function mymod_htmlextra()
Note: It is only run once - NOT one time for each item to be displayed!
If you want to learn more, check the demo module (demo.php) which came with every MyPlaza Turbo release. I learnt from there (when it still was for MyPlaza (1.2.x)), I have updated it to work with MyPlaza Turbo of course.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.