Extension talk:New User Email Notification

Archived discussions can be found here

Add a Name to mail reciptients listed in $wgNewUserNotifEmailTargets
First of all i'd like to say "thanks" to all who work(ed) on this extension: it's really cool.

Today i set up a mailadress on my mailserver which distributes incoming mail to several other adresses. I put it into $wgNewUserNotifEmailTargets in my wiki so the new user notification is sent to it. Unfortunally The Email body says now "Hello forwarder@mywikisystem.net ...".

Maybe it is possible to use an associative array instead of the simple array, something like this:

$wgNewUserNotifEmailTargets = array ( "E-Mail forwarder member" -> "forwarder@mywikisystem.net", "anothermailforwarder member" -> "forwarder2@mywikisystem.net" )

This way, even for adresses in $wgNewUserNotifEmailTargets The mail body could contain a better title.

--Rootkid 08:49, 5 September 2008 (UTC)

Users not getting confirmation email
It seems like the servers for some of the users on my wiki aren't allowing through the confirmation email. Is there anything that can be done about this from the wiki side of things? --Pschloss 18:06, 24 July 2009 (UTC)

Doesn't work in conjunction with LDAP Authentication Plugin
 SOLVED

I have Extension:LDAP Authentication running, and this extension doesn't work. If I disable LDAP, the extension does work, so that's definitely the issue. Any ideas how to make the two cooperate together? Timneu22 13:51, 23 March 2010 (UTC)


 * The fix &mdash; possibly inelegant &mdash; is to add the wfRunHooks line in SpecialUserLogin.php.

Problem with getting IP
Here is my makeMessage function:

However, I get this error:

(I use One&One).

Any ideas? -- Phantom Steve /talk &#124;contribs \ 08:57, 18 June 2010 (UTC)

Re:Problem with getting IP --jdpond 11:38, 18 June 2010 (UTC)

 * You forgot to declare $wgContIP as global (see above corrected)
 * Thanks for that, Jpond, but I'm still getting the same error! Here is a copy from my current LocalSettings.php file (copy and pasted directly):


 * And here is what I have in my current NewUserNotif.class.php (copy and pasted directly):


 * I also tried changing the line to  but I still get the same error message, but with   instead of   in the error message -- Phantom Steve /talk &#124;contribs \ 12:45, 18 June 2010 (UTC)


 * Try the above. I should have looked at this before replying.  wfGetIP requires no object, there is no such thing as $wgContIP
 * Thanks, that got the IP working. I can't get the Email address to work, but I'll leave that for now. Thanks for all your help -- Phantom Steve /talk &#124;contribs \ 15:55, 18 June 2010 (UTC)
 * See above for email address - sorry should have fixed it the first time. --jdpond 17:48, 18 June 2010 (UTC)

Re:Problem with getting IP --jdpond 00:47, 19 June 2010 (UTC)

 * I just released 1.5.2 - I'd had it in the can for over a year, but didn't want to do the documentation. You can download from trunk.


 * If you upgrade to 1.5.2, all you have to do is add the following two lines in localsettings.php below the extension inclusion:

Customizing Notification Message and Adding Parameters (>= 1.5.2) - An Example
One of the inhibitors to the adoption of MediaWiki as an Enterprise tools is the ability to vet contributers prior to their posting of information. This is especially necessary where vandilism and inappropriate postings impact directly on the reputation and brand of the community.

To avoid this, many sites have gone to a mechanism where only approved or vetted users may post. The problem here is administrative, knowing who is requesting access (creating accounts), and responding to them in a timely fashion without undue burden on the administrator who vets the editors.

This modification was made so that when a new account is created, the administrator is automatically notified. In the notification, there is a link to the userrights of that user and another "mailto" link which, when clicked, automatically creates a response email using the registered address of the requestor.

In order to do this, additional parameters were required for the email messages.

Starting with version 1.5.2, you can add additional parameters to further customize the messages. The mechanism is actually through the creation of an extension to the extension.

To do this, you need to:
 * 1) Add additional parameters to pass to the message generator
 * 2) Modify the message text body
 * 3) Modify the message subject body

Add Parameters to Pass to Message Generator
This involves creating an extension to the 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 this in your localsettings.php after you included the NewUserNotif.php for this extension.

In this example, an additional 4 parameters are added:

Modify MediaWiki:Newusernotifbody
Modify the message body to use these parameters by editing MediaWiki:Newusernotifbody:

Hello $1,

A new user account, $2, has been created on $3 at $4 for $2<$7> from IP address $9.

If this is a desired user, you should approve at: /$2.

Then notify mailto:$10<$7>&subject=Account%20Approved%20for%20$8%20Access&body=A%20new%20user%20account,%20$2,%20has%20been%20approved%20on%20$8%20at%20your%20request.%0A%0AYou%20now%20have%20approved%20rights%20at%20%20for%20this%20wiki.%0A%0AYour%20Friendly%20Sysop

Your Friendly Sysop!

Modify MediaWiki:Newusernotifsubj
Modify the message subject to use aditional parameters by editing MediaWiki:Newusernotifsubj:

[$1] New user notification User:$2

[Optional] Create new extension for customizations
It may be desirable to put the customized php file in a separate extension directory so that the main NewUserNotif directory can be updated independently. In this case, just modify the "require_once" directive in LocalSettings.php to point to the correct directory. One such example is available here. --Quantum7 (talk) 10:28, 5 May 2017 (UTC)

Does not work with 1.16
Hi,

tried but no email was sent to the admin. Also the additional targets did not receive any mail.

Re: Does not work with 1.16 --jdpond 19:23, 21 April 2011 (UTC)

 * I've had trouble with this working on several service providers, among them networksolutions, but it works fine on servers to which I have local (root). I can't seem to find a consistent pattern here.  Anyone have any ideas?

New User Email Notification => NewUserNotif
I just installed the extension in my Wiki (hope it works with my version - 19) and discovered that the directory and the line for the LocalSettings.php should not be named "New User Email Notification", as stated in the "Installation"-part of the text, but NewUserNotif, as stated in the Readme-file. Also, the download-link in the "Installation"-part did not work; I had to go via the link "tree" in the box. Maybe someone could fix this? --LiturgicaNotata (talk) 07:12, 19 September 2013 (UTC)

Fatal Error
I have been trying to install the extension, but cannot get past the error it's throwing at me. "Catchable fatal error: Argument 1 passed to MailAddress::newFromUser must be an instance of User, string given, called in xxx.xxx.xxx/includes/User.php on line 3996 and defined in xxx.xxx.xxx/includes/mail/MailAddress.php on line 59" This error appears after I click the "Create your account" button when signing up for the wiki. It appears on a big white screen. But, the notify emails do get generated. When I click on the emailed link, to verify I am real, I am taken to a login screen where I place my intended test user name and password and get the wiki message: "Login error There is no user by the name "Oscar". Usernames are case sensitive. Check your spelling, or create a new account." The user name is correct. But, the user does not appear in my user list or active list.

My Mediawiki installation is 1.24.1 --Willazilla (talk) 19:36, 18 February 2015 (UTC)

Update:

Before I posted here, I'd reached out to the original developer of this extension, Rob Church. He was able to reproduce the "bug" and related it mw 1.24.1. And, he was kind enough to help with a workaround. Rob Church is, in fact, very awesome! Following is the code:

{code} require_once "$IP/extensions/NewUserNotif/NewUserNotif.php"; $wgNewUserNotifEmailTargets = array( 'me@myemail.net' ); $wgNewUserNotifTargets = array; {code}

--Willazilla (talk) 23:18, 22 February 2015 (UTC)

ExtendedParamsExample broken for php 5.4+
The hooks for passing new parameter rely on passing output parameters by reference. Since 5.4+ such parameters are required to be declared in the function definition. Thus, the function definitions for the NewUserNotifSubject and NewUserNotifBody hooks should be

function efNewUserNotifSubject ( &$callobj, &$subjectLine , $siteName , $recipient , $user ) function efNewUserNotifBody ( &$callobj, &$messageBody , $siteName , $recipient , $user )

Neglecting the ampersands on the first two parameters causes the hooks to be ignored on my system (php 5.5).

--Quantum7 (talk) 13:31, 22 July 2016 (UTC)