FANDOM


DynamicWelcome is a module that extends the capability of Fandom's welcome tool. This allows for customized messages per administrator, per namespace (corresponding to an editor's first edit), and controlling the relative probability of which user will act as the greeter (see #Selecting a greeter).

Install

This module should be installed locally in a page titled Module:DynamicWelcome. Configuration modules will be accessed as subpages of this page and may not (as of yet) be configured for an alternate title.

The content of the page should comprise of:

return
    require "Dev:DynamicWelcome"

Configuration

At this moment in time, there are not any default messages included. This module should be configured for the default before initial usage.

To configure custom messages, create a Module:DynamicWelcome/msg page. This page may be modified by creating literal nested tables, or using the setup function of this module.

The content of the messages may be configured just the same as the default welcome tool (documentation here), but also allows the use of the pipe trick on message rendering (i.e. [[$1|]]).

Config by setup tool

This is the suggested method for creating messages, as it is arguably more readable.

To configure using the setup tool:

1. Import the setup function through

local setup = require("Module:DynamicWelcome").setup

2. Define a message header, in this format:

--- AdminName -------
ADMIN = "AdminName"   -- or "Wikia" (for admins w/o defined messages)
MODE = "message-wall" -- or "message" (for wikis with user talk pages)
CHANCE = 1 -- (optional) any *integer* >= 0, see "Selecting a greeter"

3. Set variable ANON to false. ...By convention.

ANON = false

4. Create a DEFAULT message.

DEFAULT = [=[
Message goes here.
]=]

5. Create messages for other namespaces (if desired).

Template = [=[You edited a template! [[Category:Suspicious first edit]]]=]
Template_talk = [=[You edited a template talk page.]=]

6. Generate message data with the setup function.

setup("AdminName", "message-wall", _G)

7. Repeat steps 2-6 to create messages for each additional administrator, if desired.

8. Prepend a return  (with a space) onto the last setup statement in the page.

return setup( --[[ things go here ]] )

Example (expand to view)
local setup = require("Module:DynamicWelcome").setup
 
-- <nowiki>
--- Default -------
ADMIN = "Wikia" -- admins without defined messages default here
MODE  = "message-wall"
ANON  = false
 
DEFAULT = [=[
Hello $4,
 
Welcome to the wiki! Thanks for your edit to [[:$1]].
 
You may contact me [[$2|here]]. Thanks!
]=]
 
setup("Wikia", "message-wall", _G)
 
 
--- Admin1 -------
ADMIN = "Admin1"
MODE  = "message-wall"
ANON  = false
 
DEFAULT = "yo."
Talk     = "Hmm, did you say something?"
Template = "You modified the template [[$1|]]."
 
return setup("Admin1", "message-wall", _G)

Config by literals

This section is a work in progress.

Example (expand to view)
return {
[0] = {
    {"The JoTS", 1}
},
 
["message-wall"] = {
  ["user"] = {
    ["The JoTS"] = {
      ["DEFAULT"] = 
[=[
This is the default message for undefined namespaces/main namespace.
]=],
      ["Template"] =
[=[
This is a message for edits to the template namespace.
]=]
    }
  }
}

Usage

For basic implementation, place the following in your wiki's local MediaWiki:Welcome-message-wall-user (or MediaWiki:Welcome-message-user, if using user talk pages):

For message walls
{{#invoke:DynamicWelcome|greet|$1|$2|$3|$4}}
For user talk pages
{{#invoke:DynamicWelcome|greet|$1|$2|$3|$4|mode=message}}

Selecting a greeter

This script is also able to select a user to act as a greeter, with associated relative probability weight. This functionality may be used with or without utilizing this script's primary functionality (the /msg page would still need to be partially configured however).

NOTE: This is relative probability. The total probability assigned to admins does not need to equate to 1 or 100. e.g. An admin with an assigned probability of 3 is three times more likely to have their message shown than someone with an assigned probability of 1. Additionally, the probability functionality expects an integer value and not a value less than 1.

To enable this feature, place the following in your wiki's local MediaWiki:Welcome-user page:

{{#invoke:DynamicWelcome|user}}

Internal wikilink to external link

This script is also able to convert internal wikilinks (w/o brackets) to external links that target internal pages. This functionality is provided as to minimize welcome messages' impact on wiki's maintenance reports, such as Special:WantedPages (especially on wikis that are prone to frequent page deletions or page moves). This function is particularly useful (as opposed to utilizing the URL data magic words) for the $1 argument, which may return a result such as Thread:101|How do I do things?.

This function may be used within the module's associated /msg page, or independently without utilizing the primary functionality of this script. The function may be invoked through the following syntax:

{{#invoke:DynamicWelcome|link|$1}}
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+