UseBB Community

The official board for UseBB help and discussion

UseBB Community » 1.0 Discussion » AdminCP Modules

AdminCP Modules

Page: 1

Author Post
Moderator
Registered: Oct 2005
Posts: 444
Location: canada
Am going to give this ago and see how it works out. Just wondering if you had any documentation for this at this point?

Also, when you create a module, it the adminCP you get a new category with the modules name and then a link to the module underneath it

Module 1
- Module 1 Link

I was wondering if there was anyway to control the number of links? So:

Module 1
- Module 1 Link 1 (takes you to one page of the module)
- Module 1 Link 2 (takes you to another page of the module)

and so on, and the pages would do different tasks.

Hopefully i didn't confuse you :P
Moderator
Registered: Oct 2005
Posts: 444
Location: canada
To add onto that.

I tried to get all the members from the database and i'm getting this error.

Quote
Fatal error: Call to a member function on a non-object in /home/gaia/public_html/boredawards/community/sources/modules/moderaters.php on line 16


Here is my code:


if ( defined('RUN_MODULE') ) { # required

class usebb_module { # required

function get_moderators() { # get all members

$result = $db->query("SELECT id, name, level FROM ".TABLE_PREFIX."members WHERE level = '3'");
while ($moderators = $db->fetch_result($result)) {

$output_mods .= '<form action="'.$PHP_SELF.'" method="post"><select name="award_id">
<option value="'.$moderators['id'].'">'.$moderators['name'].'</option></select></form>';
}

$list_mods = '<h2>Choose a Moderator</h2><br /><br />'.$output_mods.'';
return $list_mods;

}

function run_module() { # required

global $functions, $admin_functions;

$content = $this->get_moderators();

$content .= '<h2>Friendly URL\'s</h2>';
$content .= ( !$functions->get_config('friendly_urls') ) ? '<p>Hey, why don\'t you use our friendly URL\'s?</p>' : '<p>Thanks for using our neat friendly URL\'s feature!</p>';

$content .= '<h2>Debug</h2>';
if ( !empty($_GET['do']) && $_GET['do'] == 'nodebug' )
$admin_functions->set_config(array('debug' => 0));
$content .= '<p><a href="'.$functions->make_url('admin.php', array('act' => 'mod_test', 'do' => 'nodebug')).'">Clicking this link will disable debug info.</a></p>';

return $content;

}

Developer
Registered: Apr 2004
Posts: 2215
Location: Belgium
You can't create two links in the ACP menu to the same module.

Your error is caused because the $db object does not exist within the method, just do
global $db;
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog

Page: 1

UseBB Community » 1.0 Discussion » AdminCP Modules

UseBB Community is powered by UseBB 1 Forum Software