Extension:New User Email Notification

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
New User Email Notification

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type Notify, Hook
DescriptionTemplate:Extension#description Sends email notification when user accounts are created
Author(s)Template:Extension#username Rob Church (Robchurchtalk)
Latest versionTemplate:Extension#version 1.6.0 (2017-10-30)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README
ParametersTemplate:Extension#parameters
  • $wgNewUserNotifTargets
  • $wgNewUserNotifEmailTargets
  • $wgNewUserNotifSender
Hooks usedTemplate:Extension#hook
AddNewAccountManual:Hooks/AddNewAccount

Translate the New User Email Notification extension if it is available at translatewiki.net

Check usage and version matrix.

The New User Email Notification extension sends a customisable email to specified recipients when a new user account is created. The extension can send to multiple users, and additional email addresses, and is useful for keeping track of account creation on a small wiki.

Installation

  • Download and place the file(s) in a directory called NewUserNotif in your extensions/ folder.

Configuration

The behaviour of the extension, including notification recipients, is managed using the configuration variables below:

$wgNewUserNotifTargets
Array containing the usernames or identifiers of those who should receive a notification email; defaults to the first user (usually the wiki's primary administrator)
$wgNewUserNotifEmailTargets
Array containing email addresses to which a notification should also be sent
  • $wgNewUserNotifSender
Email address of the sender of the email; defaults to the value of $wgPasswordSender

For example, you could add this to the "LocalSettings.php" file:

$wgNewUserNotifEmailTargets = array(
    'your_email_address@example.com'
);

Customisation

The subject and text of the notification email sent to each recipient can be customised using two messages:

MediaWiki
Newusernotifsubj

Subject line

Parameter Value
$1 Site name
MediaWiki
Newusernotifbody

Body text

Parameter Value
$1 Username of the recipient
$2 Username of the new account
$3 Site name
$4 Date/time of account creation
$5 Date of account creation
$6 Time of account creation

Further Customisation

You can fully customize both the subject line and the message body, including adding new parameters which can be passed into both of those generators starting in version 1.5.2.

Starting in 1.5.2, you can also extend the message customisation by using hooks added to the extension which allow you to create new subject and body text without hacking the extension code.

This involves creating an extension to the NewUserNotif extension. For this example, the extension file "ExtendedParamsExample.php" can be found in the extension distribution. It is recommended you create a copy of this file and rename it to something meaningful to your site(s).

You would then include the new extension in your localsettings.php after you included the NewUserNotif.php.

. . .
require_once "$IP/extensions/NewUserNotif/NewUserNotif.php";
require_once "$IP/extensions/NewUserNotif/[yourExtendeParamsExample].php";
. . .

This available hooks are:

Function Version Hook Description
New User Email Notification 1.5.2 NewUserNotifBody Create text for message body of notification email
1.5.2 NewUserNotifSubject Create text for the subject line of the new user notification email

An example extension that uses this is included in the distribution as "ExtendedParamsExample.php". For more details, see this Customisation example.

See also