Skip to content
Ingo edited this page Nov 24, 2026 · 1 revision

Content: BBCodes, Replace Words, Tags and Attachments

This page covers the admin pages that deal with what users write and upload:

Page Menu Purpose
BBCode Extensions Admin > Settings > BBCode Extensions Custom BB codes (media embeds, hide tags, your own codes)
Replace Words Admin > Settings > Replace Words The bad word filter
Tags Admin > Maintenance > Tags The tags users add to their topics
Attachments Admin > Maintenance > Attachments All uploaded files of the board

The allowed file types and the maximum upload size are host settings, see Allowed file extensions and size.

Note

A host admin can always open these pages. Another admin needs them in Admin Page Access; for BB codes that is BBCode Extensions and also Add/Edit BBCode Extension for the edit page.

BBCode Extensions

The standard BB codes ([b], [url], [quote], [code], [img], ...) are built in and can't be changed. BBCode Extensions are additional BB codes stored in the database of each board. You can change, delete and add them, and copy them between boards with export and import.

The default BB codes

A new board (and every upgrade) imports the extensions from wwwroot/resources/BBCodeExtensions.xml:

BB code What it does
[MEDIA] Embeds a media URL (video and audio sites, files). The editor button Insert Media uses it.
[YOUTUBE], [VIMEO], [DAILYMOTION] Embeds a video from the URL.
[TWITTER], [INSTAGRAM], [FACEBOOK] Embeds a post from the URL.
[AUDIO] An audio player for the URL of an audio file.
[SPOILER] Text that is hidden until the reader clicks Show Spoiler.
[USERLINK] A link to the profile of the user with that name.
[HIDE] Content that is only shown after the reader has reacted to the post.
[HIDE-REPLY] Content that is only shown after the reader has replied in the topic.
[HIDE-REPLY-THANKS] Content shown after the reader has either replied in the topic or reacted to the post.
[HIDE-THANKS=x] Content only for users who received at least x reactions.
[HIDE-POSTS=x] Content only for users with at least x posts.
[GROUP-HIDE=Role1;Role2] Content only for members of the given roles (separated by ;); [GROUP-HIDE] without roles shows it to all registered users.
[ATTACH] Shows an attachment (by its number) in the post. Inserted by the attachment upload of the editor.
[ALBUMIMG] Shows an album image (by its number) in the post.

What these codes do for the users is described in the forum help (Help in the header).

Warning

Don't delete [ATTACH], [ALBUMIMG] or [MEDIA]: the editor and the attachments depend on them. If you delete an extension that is used in posts, the posts show the raw BB code text instead. Because the upgrade imports the XML file again, deleted default codes come back after an upgrade, and the default codes you changed are reset.

The list

The page lists the extensions by name, with their description, the Exec Order: and the badges Toolbar (it has an editor button) and Module (it uses a server module). Each has Edit and Delete.

  • Add new BBCode creates a new extension.
  • Export Selected to XML downloads the selected extensions (tick them, or Select all) as BBCodeExport.xml.
  • Import List uploads such an XML file (see Import and export).

Edit a BB code

General

Field Description
Name: The name of the code, e.g. NOTE. It is shown in the list and used as the default toolbar command.
Exec Order: A number from 0 to 32767. Meant as the order in which the extensions are applied (lowest first); see the note below.
Description: The text users see: the tooltip of the toolbar button, or the entry in the More BBCode menu of the editor. Usually the code with a placeholder, e.g. [NOTE]Your text[/NOTE]. Text in [localization=TAG]default text[/localization] is replaced by the text TAG of the language page BBCODEMODULE, so the description is translated.
Use Toolbar: On: the code gets its own button in the editor toolbar. Off: it is listed in the More BBCode menu (the plug icon). The toolbar button shows the Font Awesome brand icon with the name of the code (fab fa-name), so it only has a visible icon for names like youtube or twitter; for other codes leave it off.

Note

In the current version the extensions are processed in the order they come from the database, not by Exec Order:. If one code depends on another, test the result.

Regular Expression

A BB code is a search regular expression and either a replace text or a module. The expressions are not case-sensitive, and . also matches line breaks.

Field Description
Search RegEx: Required. The regular expression (.NET syntax) that finds the code in the post, including the brackets, e.g. \[note\](?<inner>.+?)\[/note\]. Name the parts you need with (?<name>...). The content between the tags is usually the group inner. An invalid expression is not saved. This is for BB codes; to replace plain words use Replace Words.
Use Module: Off: the match is replaced with the Replace RegEx:. On: a server-side class (module) creates the HTML.
Module Class Name: Only with Use Module:: the full class name with namespace and assembly, e.g. YAF.Web.BBCodes.SpoilerBBCodeModule, YAF.Web. The class must inherit from YAF.Core.BBCode.BBCodeControl (see YAF.Web/BBCodes/ExampleBBCodeModule.cs). If the class is not found, the code is left as text and the event log shows a message.
Replace RegEx: The HTML that replaces the match. ${inner} inserts the group inner, ${name} a group listed in Replace Variables:.
Replace Variables: The names of the other groups used in the replace text, separated by ; (no spaces), e.g. id;prefix. Add :encode or :decode to HTML-encode or decode the value, e.g. url:encode. A module gets these groups too, as parameters.

Javascript & CSS (optional)

Field Description
OnClick JS: The JavaScript of the toolbar button or menu entry. Empty: the button inserts the code ([NAME][/NAME]) into the editor.
Display JS: JavaScript added to the pages that show posts (topics, search, profiles) and to the editor pages, e.g. to start a player. Without <script> tags.
Edit JS: JavaScript added to the pages with the editor. Without <script> tags. {editorid} in the code is replaced with the ID of the editor.
Display CSS: CSS added to the same pages, for the HTML of the code. Without <style> tags.

Display JS:, Edit JS: and Display CSS: can contain [localization=TAG]...[/localization] as well.

Warning

The replace text, the JavaScript and the CSS are put into the pages as they are. Only add code from sources you trust, and keep user input in ${inner} from becoming script (e.g. use it only as text or as an encoded URL).

Example: a note box

Field Value
Name: NOTE
Description: [NOTE]Your note[/NOTE]
Search RegEx: \[note\](?<inner>.+?)\[/note\]
Replace RegEx: <div class="alert alert-info">${inner}</div>

Users write [note]Please read the rules first.[/note] and see the text in a blue box. The code is listed in the More BBCode menu of the editor.

Import and export

  • Export Selected to XML saves the selected extensions with all fields as BBCodeExport.xml (root element YafBBCodeList, one YafBBCode element per code).
  • Import List opens a dialog to upload such a file. An extension with a new name is added; an extension whose name exists already is overwritten with the values of the file. Entries with an invalid search expression are skipped. The message says how many codes were imported.

Use this to copy BB codes from one board to another, or to back up your own codes before an upgrade.

Replace Words

Replace Words is the bad word filter: every entry replaces a "bad" expression with a "good" one when the text is shown. The stored text is not changed, so removing an entry shows the original text again.

The replacement applies to the posts, topic titles, signatures, profiles, polls, the page titles, notification emails, feeds and quoted text.

Add or edit a replacement

Click Add New Word Replace (or Edit on an entry):

Field Description
"Bad" Expression: What to find: a regular expression (.NET syntax), not case-sensitive. A plain word works, but escape special characters with a backslash (e.g. \.). It also matches inside other words, unless you use word boundaries, e.g. \bdarn\b. An invalid expression is not saved, and each bad expression can only exist once.
"Good" Expression: The replacement text, e.g. **** or [censored]. It is a .NET replacement pattern, so $1 inserts the first group of the bad expression.

Examples:

"Bad" Expression "Good" Expression Effect
\bdarn\b d**n Replaces the whole word darn, not darning.
\b(sh)i(t)\b $1*$2 shit becomes sh*t.
fsck\w* **** Replaces fsck, fscking, ...

Test

Click Test to open the test box, enter a sentence and click Test: the page shows The text after the replacements: with all entries applied, like the posts are shown. Use it after every change to a regular expression.

Import and export

  • Export to XML downloads all entries as ReplaceWordsExport.xml (elements YafReplaceWords with BadWord and GoodWord).
  • Import from XML uploads such a file. Only entries that are not in the list yet are added; HTML in the good words is removed.

Tip

Replace Words only hides words when they are displayed. To block posts with certain words (spam), use Admin > Spam Protection > Spam Check Words, see Spam protection.

Tags

Users can add tags to their topics (the Tags: field when they create a topic or edit its first post). A tag that doesn't exist yet is created automatically, so there is no "new tag" button for admins. Very common words (the list COMMON_WORDS of the language file) are not saved as tags. On a topic, the tags are shown and link to the search for all topics with that tag.

Admin > Maintenance > Tags (the page title is Topic Tags) lists all tags of the board:

  • Search tags filters the list by part of the name.
  • The badge of each tag shows the number of topics with the tag; click it (Show Topic(s)) to search for these topics. Tags that are no longer used show 0; they are not removed automatically.
  • Delete removes the tag from all topics and deletes it. The topics themselves are not changed.

Use it to clean up typos, duplicates or unwanted tags.

Attachments

Admin > Maintenance > Attachments (the page title is User Attachments) lists all files uploaded by the users of the board, newest first. Each entry shows:

  • a preview of an image or an icon for the file type, and the file name,
  • the user who uploaded it, the size and the number of Downloads,
  • Usages: the number of posts that show the file. Show posts opens the post (or a list of the posts).

Delete removes the attachment and its file. Posts that showed it simply don't show it anymore. A file with 0 usages is not used in any post (e.g. it was uploaded but the post was never sent, or the post was changed); you can delete it to free space.

You can also see and delete the attachments of one user on the user's page (Admin > Users and Roles > Users, tab Attachments), and users manage their own files under Attachments in their profile.

Allowed file extensions and size

The upload rules are in Admin > Host Settings (host admin only), see Host Settings:

Setting Where Default Description
Allowed File Extensions: Host Setup tab, Attachments Settings bmp,doc,gif,jpg,jpeg,webp,mov,mp3,mpg,png,rar,tif,txt,xls,xml,zip The file types users may upload, separated by commas (spaces and dots are allowed, e.g. pdf, .docx). An upload with another extension is refused with "Invalid File". The upload is also refused when the content of the file doesn't match its extension.
Max File Size: Host Setup tab, Attachments Settings empty (no limit) The maximum size of an uploaded file in bytes, e.g. 5242880 for 5 MB. The upload dialog shows the limit in KB.
Use File Table: Host Setup tab off Saves uploaded files in the database instead of the folder wwwroot/uploads. Changing it later doesn't move existing attachments; they stay where they are and keep working.
Image Attachment & Resize Settings Host Setup tab Image Attachment Display Threshold: (images larger than this are shown as a link instead of the image), the thumbnail size and the maximum width and height of uploaded images (larger images are resized when they are uploaded).

Who may upload and download is set per role: Upload Access and Download Access on the role's page (Admin > Users and Roles > Roles), see Users, Roles and Permissions.

Note

The web server has its own limit for the size of a request (e.g. about 28.6 MB for Kestrel and IIS, client_max_body_size for nginx, 1 MB by default). For larger files raise that limit as well, see Hosting on Linux with nginx.

See also

Clone this wiki locally