Fandom Developers Wiki
Advertisement

NoLicenseWarning shows a warning message when an user attempts to upload a file without selecting a license. By default, they can upload the file anyway by simply resending the form.

Installation

Configuration

You can configure whether the script should prevent users from uploading files without licenses or just let them know that selecting a license is strongly recommended (default) and which user groups won't be affected by this script. It's also possible to change the default warning and rejection messages.

Script settings

Script configuration is stored in the window.NoLicenseWarning object and following variables are available:

Variable Description Data type Default value
forceLicense Whether a license should be forced or not. Boolean false
excludedGroups List of user groups that aren't affected by script. You can check user groups available on your wiki by visiting Special:ListGroupRights. Array ['bureaucrat','sysop','content-moderator','bot']

Code below contains example configuration that you can use by adding to the MediaWiki:Wikia.js page on your wiki:

// Configuration for NoLicenseWarning
window.NoLicenseWarning = {
    forceLicense: true,
    excludedGroups: [
        'sysop',
        'threadmoderator',
        'content-moderator',
        'rollback'
    ]
};

Custom messages

If you want to use different banner messages, add following code to the MediaWiki:Wikia.js page on your wiki:

// Prepare custom messages for NoLicenseWarning
window.dev = window.dev || {};
window.dev.i18n = window.dev.i18n || {};
window.dev.i18n.overrides = window.dev.i18n.overrides || {};
window.dev.i18n.overrides['NoLicenseWarning'] = window.dev.i18n.overrides['NoLicenseWarning'] || {};

// Add custom content instead of default messages
window.dev.i18n.overrides['NoLicenseWarning']['warning-text'] = 'Your custom warning message';
window.dev.i18n.overrides['NoLicenseWarning']['rejected-text'] = 'Your custom rejected message';

Other notes

  • This script doesn't take any effect on in-editor upload forms and modals available on the Special:Images page due to technical difficulties with providing such support.
  • Users within global groups such as staff, wiki-manager, helper, etc. are never affected by this script. Local user groups exceptions can be configured in the excludedGroups array.
  • It's possible for users to bypass this script by disabling JavaScript in their web browser or by using the ?usesitejs=0 URL parameter (?safemode=1 on UCP wikis). There's no technical solution available to prevent users from uploading unlicensed files with absolute effectiveness.
Text above can be found here (edit)
Advertisement