Help Center

Find answers or browse our knowledge base.

Creating a User Settings Page

Every addon can provide its own settings page inside the user’s /setting area. This is handled automatically by the plugin system if you follow the correct structure.


1) Required Files

If your addon has a modules/addonid/settings.php file, you must also create these files inside your theme:

  • templates/addonid/tabs/user_settings_link.tpl – the link that shows in the settings menu
  • templates/addonid/tabs/user_settings_content.tpl – the content logic that shows the settings page
  • templates/addonid/settings.addonid.tpl – the actual template file for your addon’s settings form/page

These will be picked up automatically when your addon is activated, as long as the hook user_settings_link.tpl and user_settings_content.tpl are injected in the theme.


2) Adding a Link to Settings Menu

Inside templates/addonid/tabs/user_settings_link.tpl add an entry for your settings page. Replace demoaddon with your addon ID.

<a class="dropdown-item" href="{$system['system_url']}/settings/demoaddon/">
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
    <path d="M2 2h12v12H2z"/>
  </svg>
  {__("Demo Addon Settings")}
</a>

When the user clicks this link, it will go to /settings/demoaddon/.


3) Defining Your Settings Page Logic

Inside templates/addonid/tabs/user_settings_content.tpl, add an if block for your view:

{if $view == "demoaddon"}
  {include file='settings.demoaddon.tpl'}
{/if}

This ensures your content only displays when the URL is /settings.php?view=demoaddon or /settings/demoaddon/.


4) Building the Settings Page

Create templates/addonid/settings.demoaddon.tpl with your form or settings markup.

    
<div class="card">
  <div class="card-header">{__("Demo Addon Settings")}</div>
  <div class="card-body">
    <form method="post" action="{$system['system_url']}/modules/demoaddon/settings.php">
      <div class="mb-3">
        <label class="form-label">{__("Enable Feature")}</label>
        <input type="checkbox" name="enable_feature" value="1">
      </div>
      <button type="submit" class="btn btn-primary">{__("Save Settings")}</button>
    </form>
  </div>
</div>

5) Handling Settings in PHP

Inside your addon’s modules/demoaddon/settings.php, handle form submissions and save to the database:

<?php
require('../../../bootloader.php');
global $db, $user;

if(!$user->_logged_in) {
  user_login();
}

if($_SERVER['REQUEST_METHOD'] === 'POST') {
  $enabled = isset($_POST['enable_feature']) ? 1 : 0;
  $db->query("UPDATE demoaddon_settings SET enabled = '{$enabled}' WHERE user_id = {$user->_data['user_id']}");
  redirect('/settings/demoaddon');
}

✅ Summary

  • Add your menu link in user_settings_link.tpl
  • Add your conditional loader in user_settings_content.tpl
  • Build your page in settings.addonid.tpl
  • Handle logic in modules/addonid/settings.php

Once your addon is activated, the plugin system automatically registers your case demoaddon into the main settings.php file and your page will show up under the user’s settings area.

Was this answer helpful?
You must login to vote.
0 found this helpful, 0 did not
Thank you for your feedback!

Related Articles