Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!

Creating the Module Form Controller Index Creating a new Tool Option in the Jamroom Tools Menu: tools.php

Creating a Module Control panel in the Jamroom Config: config.php

Similar to how we created a "quota.php" script to enable per-Jamroom Quota configurations, we can also optionally create a file called "config.php" which allows us to insert an entry in the "Modules" section of the Jamroom Config.

This allows us to create entries in Jamroom's master $config array, which contains global settings that may be needed throughout Jamroom:

 * Jamroom Custom Modules master settings config
 * @copyright 2008 by Brian Johnson / Talldude Networks LLC
 * @author Brian Johnson - bigguy@talldude.net
defined('IN_JAMROOM') or exit();

 * The creates the Jamroom Config form for the module
 * @param array Jamroom Master config array
 * @return bool Returns true
function jrYouTube_config($config)
    jmSpanCell('YouTube Video Settings','Config Settings for the YouTube Videos Module');
    jmInput('YouTube Base URL','jryoutube_base_url','text',$config['jryoutube_base_url'],
      'What is the YouTube URL you wish to place before the YouTube ID in your output?');

 * The _verify function validates our $_post
 * @param array Posted form results
 * @return mixed returns bool true on success, array on failure
function jrYouTube_verify($_post)
    // Verify our YouTube URL
    if (!checkType($_post['jryoutube_base_url'],'url')) {
        $_tmp['error_text']  = 'You have entered an invalid value for the YouTube URL setting
          - please enter a valid URL';
        $_tmp['error_field'] = 'jryoutube_base_url';

You can see that the config.php script is very similar to the quota.php script:

  • We have our _config function that does the actual form display in the Module control panel
  • We have our _verify function that is used to validate the posted form data

The idea is the same - Jamroom will run the _config function when the Master Admin loads the section from the Jamroom Config menu, and after the form is saved, the _verify function will be executed with the posted form data passed in as $_post.  Inside the _verify function you will have access to the posted data where you can validate that data fits the proper format and either return TRUE to indicate everything looks good, or create your error array to let Jamroom know an error was encountered in one of the fields.


Creating the Module Form Controller Creating the Module Form Controller page 12 of 23 Creating a new Tool Option in the Jamroom Tools Menu: tools.php Creating a new Tool Option in the Jamroom Tools Menu: tools.php
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Support Center
Contact Support
Community Forum
Member Sites
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network