summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/NewUserNotif/NewUserNotif.php
blob: dc75aaf061ba3a193b20d7ab76908ccd27c4c466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
if ( ! defined( 'MEDIAWIKI' ) )
    die();

/**
 * Extension to provide customisable email notification of new user creation
 *
 * @file
 * @author Rob Church <robchur@gmail.com>
 * @ingroup Extensions
 * @copyright © 2006 Rob Church
 * @license GNU General Public Licence 2.0 or later
 */

$wgExtensionCredits['other'][] = array(
	'path' => __FILE__,
	'name'           => 'New User Email Notification',
	'version'        => '1.6.0',
	'author'         => 'Rob Church',
	'url'            => 'https://www.mediawiki.org/wiki/Extension:New_User_Email_Notification',
	'descriptionmsg' => 'newusernotif-desc',
);

$dir = dirname(__FILE__) . '/';
$wgMessagesDirs['NewUserNotif'] = __DIR__ . '/i18n';
$wgAutoloadClasses['NewUserNotifier'] = $dir . 'NewUserNotif.class.php';
$wgExtensionFunctions[] = 'efNewUserNotifSetup';

/**
 * Email address to use as the sender
 */
$wgNewUserNotifSender = $wgPasswordSender;

/**
 * Users who should receive notification mails
 */
$wgNewUserNotifTargets[] = 1;

/**
 * Additional email addresses to send mails to
 */
$wgNewUserNotifEmailTargets = array();

/**
 * Extension setup
 */
function efNewUserNotifSetup() {
	global $wgHooks;
	$wgHooks['AddNewAccount'][] = 'efNewUserNotif';
}

/**
 * Hook account creation
 *
 * @param User $user User account that was created
 * @return bool
 */
function efNewUserNotif( $user ) {
	return NewUserNotifier::hook( $user );
}