Hello There, Guest! › Register

MySubscriptions 2.3.3 released.
Looking for a custom plugin for your site? Ask here for a quote.

How to create a MyPlaza Turbo module

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)

PHP Code:
function mymod_lang()
// stick your extra languages here, eg:
        // case 'randomlanguage':
        //     $lang->hello = 'aslfkdjoiqwerpo';
        //   ...
        //     break;
        // default to english
        //case 'english':
$lang->mymod_buy_tickets 'Buy tickets';
$lang->mymod_buy_tickets_details 'By buying tickets, you just lose money.';

This functions contains all language variables (user part).

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()
// add extra languages here
$lang->mymod_name 'MyModule Example';
$lang->mymod_description 'MyModule example description.';
$lang->mymod_options 'MyModule Options';

This function contains all language variables (admin part).

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()
    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)

Module information displayed in the Admin CP (Modules page).

PHP Code:
function mymod_activate() 
Activates the module. Edit templates/Create tables/update database/add new fields into database tables here.

PHP Code:
function mymod_deactivate() 
Deactivates the module. Remove template edits/delete database tables created here.

PHP Code:
function mymod_admin($process
Module options page.
$process - true if processing options

User part
PHP Code:
function mymod_run($item
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

PHP Code:
function mymod_page() 
Creates a custom page for your module.
It's accessible from /plaza.php?action=page&p=mymod

PHP Code:
function mymod_htmlextra() 
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.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

It's easy Big Grin.
hahahaha Tongue.
Nice tutorial though, must've taken you a LOONG time to make this Smile.
I learnt to code ( though I could code PHP already ) myplaza through the sample module(demo.php), then I made really simple modules a bit like that one but differently and finally when I could do it ( or when it bugged I called Nervo for help ahah - Thanks for all the support though, Nervo Smile ) I tried coding more complex modules then Smile.

Thank you Smile,
- Shadows.

Great tutorial...
Now, if only someone would release a tut for normal MyBB plugins. That would rock!
free web hosting
-Free hosting!
-Free top-level domains!
-cPanel 11
[Image: mybbsig.php]

I have some at my site Smile. ( my sig )
- Shadows.

Users browsing this thread: 1 Guest(s)