Extension talk:New User Email Notification
Archived discussions can be found here
[edit] 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)
[edit] 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)
[edit] 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 — possibly inelegant — is to add the wfRunHooks line in SpecialUserLogin.php.
/** * Actually add a user to the database. * Give it a User object that has been initialised with a name. * * @param $u User object. * @param $autocreate boolean -- true if this is an autocreation via auth plugin * @return User object. * @private */ function initUser( $u, $autocreate ) { global $wgAuth; $u->addToDatabase(); wfRunHooks( 'AddNewAccount', array( $u ) );
[edit] Problem with getting IP
Here is my makeMessage function:
private function makeMessage( $recipient, $user ) { global $wgSitename, $wgContLang, $wgContIP, $wgContEmail; return wfMsgForContent( 'newusernotifbody', $recipient, $user->getName(), $wgSitename, $wgContLang->timeAndDate( wfTimestampNow() ), $wgContLang->date( wfTimestampNow() ), $wgContLang->time( wfTimestampNow() ), $wgContIP->wfGetIP(), # $7 = IP $wgContEmail->getEmail() # $8 = email address ); }
However, I get this error:
Fatal error: Call to a member function wfGetIP() on a non-object
in /homepages/xx/dxxxxxxxx/htdocs/w/extensions/NewUserNotif/NewUserNotif.class.php on line 100
(I use One&One).
Any ideas? -- PhantomSteve/talk|contribs\ 08:57, 18 June 2010 (UTC)
[edit] 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):
#New User Notif
require_once( "{$IP}/extensions/NewUserNotif/NewUserNotif.php" );
# $wgNewUserNotifTargets = array (All-Changes) : 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
-
- And here is what I have in my current NewUserNotif.class.php (copy and pasted directly):
private function makeMessage( $recipient, $user ) { global $wgSitename, $wgContLang, $wgContEmail; return wfMsgForContent( 'newusernotifbody', $recipient, $user->getName(), $wgSitename, $wgContLang->timeAndDate( wfTimestampNow() ), $wgContLang->date( wfTimestampNow() ), $wgContLang->time( wfTimestampNow() ), wfGetIP(), # $7 = IP '$user->getEmail()' # $8 = email address ); }
-
- I also tried changing the line to
but I still get the same error message, but with
$wgContIP->GetIP(),
GetIP()instead ofwfGetIP()in the error message -- PhantomSteve/talk|contribs\ 12:45, 18 June 2010 (UTC)
- I also tried changing the line to
-
-
- 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 -- PhantomSteve/talk|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)
- 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 -- PhantomSteve/talk|contribs\ 15:55, 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
-
[edit] 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:
$wgNewUserNotifSenderParam[] = 'wfGetIP()'; // $7 Submitter's IP Address $wgNewUserNotifSenderParam[] = '$user->getEmail()'; // $8 email
[edit] 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:
- Add additional parameters to pass to the message generator
- Modify the message text body
- Modify the message subject body
[edit] 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.
. . . require_once( "{$IP}/extensions/NewUserNotif/NewUserNotif.php" ); require_once( "{$IP}/extensions/NewUserNotif/[yourExtendeParamsExample].php" ); . . .
In this example, an additional 4 parameters are added:
| 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 |
| $7 | new account email address |
| $8 | Site name encoded for email message |
| $9 | Submitter's IP Address |
| $10 | User Name encoded for email message link |
[edit] 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: {{fullurl:Special:UserRights}}/$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{{urlencode:{{SERVER}}}}{{SCRIPTPATH}}%20for%20this%20wiki.%0A%0AYour%20Friendly%20Sysop
Your Friendly Sysop!
[edit] Modify MediaWiki:Newusernotifsubj
Modify the message subject to use aditional parameters by editing MediaWiki:Newusernotifsubj:
[$1] New user notification User:$2
[edit] 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.
[edit] 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?