Adding a Section to Profiles

Applies to: Jamroom 7.0+ Last verified: 2026-10-24
  • What it does

    A module can add its own section to every profile, with an entry in the profile menu: yoursite.com/(profile)/(module url).

  • The module

    Create a module (see Creating a Module) with this include.php:

    <?php
    defined('APP_DIR') or exit();
    
    function xxBar_meta()
    {
        return array(
            'name'        => 'Bar',
            'url'         => 'bar',
            'version'     => '1.0.0',
            'developer'   => 'Your Name, ©' . date('Y'),
            'description' => 'Adds a Bar section to profiles',
            'category'    => 'profiles',
            'license'     => 'mpl'
        );
    }
    
    function xxBar_init()
    {
        // "Allowed on Profile" in Quota Config
        jrCore_register_module_feature('jrCore', 'quota_support', 'xxBar', 'on');
        return true;
    }
  • And templates/item_index.tpl, the section's page:

    <div class="block">
        <h2>Bar</h2>
        <p>This is the Bar section of {$profile_name}.</p>
    </div>
  • Activate the module, and check Allowed on Profile in its Quota Config for the quotas that should have the section.

  • The menu entry

    The profile menu lists modules that have items on the profile. A module without a DataStore has no items, so its entry needs to be always shown. Register it in _init():

    jrCore_register_module_feature('jrProfile', 'profile_menu', 'xxBar', 'always_show');
  • Skins can also show it with always_show="xxBar" on {jrProfile_menu}. See {jrProfile_menu}.

  • More than a template

    For pages with logic, add profile.php with profile_view_xxBar_default($_profile, $_post, $_user, $_conf), which returns the page's HTML. See Module File Structure.

Tags