{$variable|jrCore_format_string}

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

    jrCore_format_string formats text that members write, such as a blog post or a biography. It runs every text formatter the member's quota allows, so a template doesn't need to know which ones the site has:

    {$item.blog_text|jrCore_format_string:$item.profile_quota_id}
    {$profile_bio|jrCore_format_string:$profile_quota_id}
  • Always pass the quota ID of the profile the text belongs to. Formatters are turned on per quota.

  • jrCore_format_string

    Function
    jrCore_format_string
    parameter
    type
    default
    required
    description
    (1) quota_id
    int
    -
    on
    The quota ID of the profile the text belongs to
    (2) whitelist
    string
    -
    off
    Only run these formatters, comma separated
    (3) blacklist
    string
    -
    off
    Run all formatters except these, comma separated

    The options are given after the modifier, separated by colons.

  • The formatters

    Admins choose the formatters for each quota in ACP > Modules > Core > System Core > Quota Config > Active Text Formatters. A fresh Jamroom has:

    Name Label What it does
    html Allow HTML Keeps the HTML tags allowed in the quota's Allowed HTML Tags
    bbcode Allow BBCode Turns BBCode, such as [b], into HTML
    at_tags Convert @ Tags Links @profile_name to the profile
    click_urls Make URLs Clickable Turns web addresses into links
    hash_tags (Timeline) Links #hashtags
    embed (Editor Embedded Media) Turns [jrEmbed] tags into media

    Other modules add more. See What is a Text Formatter?.

  • Choosing formatters in a template

    Only run some formatters with a whitelist, or skip some with a blacklist:

    {$item.comment_text|jrCore_format_string:$item.profile_quota_id:"bbcode,click_urls"}
    {$item.comment_text|jrCore_format_string:$item.profile_quota_id:false:"bbcode"}
  • Adding a formatter in a module

    Register the formatter in your module's _init() function:

    $_tmp = array(
        'wl'    => 'click_urls',
        'label' => 'Make URLs Clickable',
        'help'  => 'If active, URLs entered into the text will be hyperlinked so they are clickable.'
    );
    jrCore_register_module_feature('jrCore', 'format_string', 'jrCore', 'jrCore_format_string_clickable_urls', $_tmp);
    • wl: the name used in whitelists and blacklists
    • label and help: shown in Active Text Formatters
    • the fourth value: your function. It gets the text and the quota ID, and returns the formatted text:
    function jrCore_format_string_clickable_urls($string, $quota_id = 0)
    {
        return jrCore_string_to_url($string);
    }
  • A formatter can't take options from the template. If it needs one, such as a size, make it a Global Config setting of your module.

Tags