Last modified: 2010-05-15 15:54:47 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17068, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15068 - New hook request UserMailer.php
New hook request UserMailer.php
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Email (Other open bugs)
1.12.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Brion Vibber
: patch, patch-need-review
: 9607 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-07 13:37 UTC by Coban Holmes
Modified: 2010-05-15 15:54 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Proposed new hook in UserMailer.php (18.82 KB, patch)
2008-08-11 13:25 UTC, Coban Holmes
Details
Patch based on previous file submit. (545 bytes, patch)
2008-08-11 13:52 UTC, Siebrand Mazeland
Details
Add $wgEnotifUseRealName (3.82 KB, patch)
2008-08-11 21:57 UTC, Chad H.
Details

Description Coban Holmes 2008-08-07 13:37:20 UTC
I think it would be beneficial to add a hook in UserMailer.php just before email is sent. I know there is the EmailUser hook, but it doesn't allow for extensions to be triggered before enotif emails are sent. I would think a simple hook added to UserMailer::send() would help some extension writers.
Comment 1 Siebrand Mazeland 2008-08-10 23:22:11 UTC
Can you please be more specific? Adding hooks without proper use cases is usually a no-go.
Comment 2 Coban Holmes 2008-08-11 13:25:17 UTC
Created attachment 5158 [details]
Proposed new hook in UserMailer.php

Proposed hook, I don't know if this is the exact location it should be or not.
Comment 3 Siebrand Mazeland 2008-08-11 13:26:50 UTC
Assigned to brion for yes/no/questions.
Comment 4 Coban Holmes 2008-08-11 13:40:58 UTC
I uploaded a copy of UserMailer.php that I have modified to include the hook (I just named it 'BeforeEmailSend'), I am not familiar at all with how new hooks are requested/added. I'm not sure if its a good idea to pass in everything like I have it or just subject and body.

The only way right now to modify the email messages that are sent out from enotif is to change 'MediaWiki:Enotif body' which is great, but I have the need to replace the user id with the user's real name which can only be done with an extension and there are no current hooks to accomplish this task. I know there is at least one other extension (http://www.mediawiki.org/wiki/Extension:FormatEmail) that has referenced the desire to edit these emails.

Thats basically what has prompted me to request this.
Comment 5 Siebrand Mazeland 2008-08-11 13:50:01 UTC
You have not edited the most recent version of this file. Please *always* use the most recent version in the repository when submitting patches[1]. Also, never upload a complete file. Upload a unified diff.

I will attach a patch based on what you sumitted.

[1] http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/UserMailer.php?view=co
Comment 6 Siebrand Mazeland 2008-08-11 13:52:15 UTC
Created attachment 5160 [details]
Patch based on previous file submit.
Comment 7 Brion Vibber 2008-08-11 21:07:21 UTC
This would trigger on *all* email sends, not just notification emails.

* Password resets
* Email confirmation mails
* User-to-user emails
* Anything sent by other extensions

The only good use I can think of for a hook in this spot is to provide an alternative email-sending backend, but to be functional it would have to be able to take over from the following code. (Eg, check for a false return code and return a result variable passed back from the hook.)

If you want something specifically for modifying notification mails, you presumably want something much more specific.

It sounds like what you want is actually to modify the behavior of the MailAddress class such that it'll grab the user's "real name" field instead of the username when constructing the quoted address fields.
Comment 8 Chad H. 2008-08-11 21:57:29 UTC
Created attachment 5165 [details]
Add $wgEnotifUseRealName

Implement Brion's suggestion above. Allow sending the e-mails with the user's real name as opposed to their username. Also possibly fixes bug 9607.
Comment 9 Siebrand Mazeland 2008-08-11 22:01:37 UTC
Keywords: patch, need-review
Comment 10 Siebrand Mazeland 2008-11-03 21:32:46 UTC
Patch 5165 applied in r43155. Does this satisfy the requirement laid out in the original request? If so, please mark this bug FIXED.
Comment 11 Mike.lifeguard 2008-11-22 18:54:40 UTC
(In reply to comment #10)
> Patch 5165 applied in r43155. Does this satisfy the requirement laid out in the
> original request? If so, please mark this bug FIXED.
> 

Looks like it was fine; marking as FIXED.
Comment 12 Alexandre Emsenhuber [IAlex] 2010-04-06 21:16:32 UTC
*** Bug 9607 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links