Good Tutorial for Making ACP Modules

Discuss phpBB 3.0.x in general.
Forum rules
Please post any phpBB 3.1.x related topics in the phpBB 3.1.x discussion forum.
comkid
New member
New member
Posts: 18
Joined: 28 Jun 2009, 11:32

Good Tutorial for Making ACP Modules

Postby comkid » 29 Jun 2009, 05:21

Does anyone know any good tutorials for making ACP modules?

Also how do you make a radio form in the ACP module?

User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian

Re: Good Tutorial for Making ACP Modules

Postby Obsidian » 29 Jun 2009, 11:54

Here's one tutorial on STG...
http://startrekguide.com/community/viewtopic.php?f=50&t=9465


Mostly, you've got to wing it when you're writing it, and just have fun. Learn from the errors you get. :)

Here's a little breakdown for what that class includes.

Code: Select all

class acp_foo // Class name.  Always have the acp_ prefix!  This should be the same name as the file it is in.
{
    var $u_action; // Just leave this in here.
    var $new_config;
    function main($id, $mode) // The main function.  This is called when the ACP module is loaded
    {
        global $db, $user, $auth, $template; // Globaling in the phpBB classes...
        global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
        switch($mode) // We're switching between modes here.
        {
            case 'index':
                $this->page_title = 'ACP_FOO'; // Set the page title to be the contents of $user->lang['ACP_FOO']
                $this->tpl_name = 'acp_foo'; // This gets us to use the ACP template file named acp_foo.html
                break;
        }

    }
}&
nbsp;  &nbsp

comkid
New member
New member
Posts: 18
Joined: 28 Jun 2009, 11:32

Re: Good Tutorial for Making ACP Modules

Postby comkid » 29 Jun 2009, 14:15

Thanks I'll check that out, also how do I make a MOD show, I don't get how you set up permissions for it.

User avatar
Mr. Bond
Member
Member
Posts: 89
Joined: 30 Mar 2008, 20:34
Real name: Bobby
Location: 127.0.0.1

Re: Good Tutorial for Making ACP Modules

Postby Mr. Bond » 29 Jun 2009, 16:04

comkid wrote:also how do I make a MOD show

If you mean module show, you simply add it like any other module, under the system tab.
I don't get how you set up permissions for it.

For actually adding permissions: http://phpbbmodders.net/articles/3.0/permissions/

To require a certain permission to view the module, you change the 'auth' parameter in the info file. For example.

Code: Select all

<?php
/**
*
* @package acp
* @version $Id: acp_main.php 8479 2008-03-29 00:22:48Z naderman $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @package module_install
*/
class acp_main_info
{
    function module()
    {
        return array(
            'filename'    => 'acp_main',
            'title'        => 'ACP_INDEX',
            'version'    => '1.0.0',
            'modes'        => array(
                'main'        => array('title' => 'ACP_INDEX', 'auth' => 'acl_my_permission', 'cat' => array('ACP_CAT_GENERAL')),
            ),
        );
    }

    function install()
    {
    }

    function uninstall()
    {
    }
}

?>

See 'auth' => 'acl_my_permission', just change acl_my_permission to the permission name.
Twitter • Ohloh • GitHub

comkid
New member
New member
Posts: 18
Joined: 28 Jun 2009, 11:32

Re: Good Tutorial for Making ACP Modules

Postby comkid » 30 Jun 2009, 01:28

I don't get how to add permissions to Modules :?

User avatar
SamT
Past Contributor
Past Contributor
Posts: 79
Joined: 14 Jun 2009, 16:29
Real name: Sam
Location: Sacramento, CA, USA

Re: Good Tutorial for Making ACP Modules

Postby SamT » 31 Jul 2009, 23:52

You see where it says " 'auth' => 'acl_my_permission' "? the acl_my_permission is the auth, you have to make a plugin to be able to use it. When you first start off making modules, I would recommend using one you find in another module to avoid having to figure out how to make the auth plugins right away.

comkid
New member
New member
Posts: 18
Joined: 28 Jun 2009, 11:32

Re: Good Tutorial for Making ACP Modules

Postby comkid » 01 Aug 2009, 12:22

Well I want to make a form in ACP to set up its own permissions so how would I do?

I was thinking of using the $config.

User avatar
Mr. Bond
Member
Member
Posts: 89
Joined: 30 Mar 2008, 20:34
Real name: Bobby
Location: 127.0.0.1

Re: Good Tutorial for Making ACP Modules

Postby Mr. Bond » 03 Aug 2009, 00:22

I'm not sure what you are asking, but to add permissions, there is a good tutorial on the Wiki: http://wiki.phpbb.com/Permissions

You would not want to use the config table for permissions... ;)
Twitter • Ohloh • GitHub

thalegend
New member
New member
Posts: 1
Joined: 18 Nov 2009, 10:47

Re: Good Tutorial for Making ACP Modules

Postby thalegend » 18 Nov 2009, 10:48

Thanks


Return to “phpBB 3.0.x "Olympus" discussion”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 1 guest