From Mario Fan Games Galaxy Wiki
Jump to: navigation, search

MGet is a Mediawiki extension written by Kyori and Char. It adds several magic words that are used to automatically update user information on the MFGG Wiki using data from the MFGG Forums.

These magic words are used in the new MFGGer template, so it is no longer necessary to specify, or update, the badges or groups (or various other data) that a user currently has.



The data that the extension pulls from the forums consists of:

  • Username
  • Mainsite ID
  • Groups
  • Rank
  • Badges
  • Flag
  • Gender
  • Age
  • Location
  • Occupation
  • Interests
  • Website
  • Whether the user has certain IM clients


This section explains how to use the extension (through the use of the 2 magic words). To omit an optional parameter, leave the section blank.


This magic word instructs the extension to check for any information that it might have on a particular user, then to make that information available. The syntax is as follows:

{{#forumite: forumid}}

Where forumid is the ID of the user on the MFGG forums.

If there is no information whatsoever on the user (i.e. the cache has not been updated) then the extension will return "err01".

It should be noted that due to the probable long life of the cache (2-4 hours), information may not be available when you first use the magic word (meaning that there is no information in the cache related to the user ID that you are using). However, you can be confident in the fact that as soon as the cache expires and badges are viewed, all requested information will be updated.


This magic word allows the display of various user information which has been previously made available by the {{#forumite}} magic word. The syntax is as follows:

{{#field: fieldname}}

Where fieldname is the name of the field that you wish to display.

The names of the available fields are as follows:

user_id, badges, groups, primary_group, flag, site_id, icq, aim, yim, msnm, jabber, age, website, interests, occupation, location, rank, name, gender, pulled

Most of those will be self explanatory, however some will need explaining.

icq, aim, yim, msnm and jabber

These do not return the addresses ofr the user on the respective instant messaging network, but instead return either true or false (in actuality, 1 or 0) if the user has an account on the network in question or not, respectively.


This is the username of the user in question, not their actual name.


This is either true or false depending on whether the extension has pulled information from the forums about this user or not.

{{#field}} for arrays

Some of the variables (badges and groups) that can be shown through the use of this magic word are arrays. This magic word allows a certain amount of flexibility in displaying arrays over displaying non-arrays.

prefixes and suffixes

A prefix and a suffix may be affixed to each top-level member of an array. The syntax is as follows:


Where prefix and suffix are the specified prefix and suffix.


Delimiters may be used to separate each member of the array any deeper than top-level. By default, a comma (,) will be used to separate them, but this will likely be confusing for any array with more than 2 dimensions (as any further dimensions become impossible to differentiate between). Multiple delimiters can be specified as such:

{{#field:fieldname|prefix|suffix|delimiter1|delimiter2|delimiter3| ... | delimitern}}

Where delimiter1, delimiter2, etc. are the chosen delimiters for the increasing dimensions of the array.

An example

This is an example of how to use this magic word for arrays (code taken from the MFGGer template badge section):


Where {{dd}} and {{bb}} are templates that return {{ and }} respectively, and {{!}} is a template that returns |. These templates are necessary due to the way that mediawiki handles the parsing of parser functions (like this magic word) and templates. When expanded and inserted back into the above example, it would look like this:


Which, when submitted to the parser, would completely confuse it (or at least, there'd be some confusion between what we want from the parser and what we're actually going to get!).

In the example, the following parameters are given to the extension:

  • Field name = badges
  • Prefix = {{dd}}Badge{{!}} or {{Badge| (the beginning of the MFGG Badge template call)
  • Suffix = {{!}}auto=true{{bb}} or }} (the end of the badge template call, auto=true tells the Badge template to do a little bit of extra formatting when dealing with parameters that it's passed, to make it easier to change things around without breaking functionality)
  • Delimiters = {{!}} or | (a wiki pipe character, used to separate parameters in template calls)

The badge variable returns a 2 dimensional array, so only one delimiter is required. This array consists of a top level filled with "badges", which are, in and of themselves, arrays of 2 variables (the badge ID, and the amount of badges of that type). So when the extension returns this array, it wraps each "badge" in the prefix and suffix (the beginning and end of the Badge template call) then, in between them, it lists the members of the next level down (the ID and amount) separated by the delimiter (the pipe character). An example of a returned set of badges is as follows:


Which would give you...


...when the parser expands the templates.


When the extension is called, it checks whether the cache has expired (the cache lifetime is specified with $wgMFGGBadgesCacheTime).

  • If the cache hasn't expired, the extension adds the requested user ID to a cached list of user IDs.
  • If the cache has expired, the extension makes a POST request containing an array of the previously cached user IDs to a script in the forum directory, which then queries the database for the information for those users. The script returns the information and the extension caches it in a local file.

The script then sorts through the information (either from the cache or from a request) and finds the requested user information, then returns them in the correct template format.

For badges:


For groups:


Note: auto is set to true so that the templates know to run specific formatting on the results.

Configuration Variables

These are the various settings that can be modified in LocalSettings.php.

# Address of the forum badge get script
# Number of seconds that the cache should live for (set to 4 hours (14400 seconds) by default)
# Security code to be provided to the forum script

Version Log

  • v0.0.1 - Not in general usage due to being just a little bit buggy!
  • v0.1.0 - Badges and groups working.
    • v0.1.1 - Changed "error" message for empty cache to display time to recache.
    • v0.1.2 - Wiki caching disabled for pages using the extension, bug with default groups on Guinea, Char and Kyori articles (not fixed) (void due to rewrite).
  • v0.2.0 - Complete rewrite. Now caches in wiki database instead of in filesystem. Pulls more information from server, and more cleverly calculates needed groups and badges.
Personal tools