[wp-trac] [WordPress Trac] #8833: extract pluggable.php function logic into separate functions
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 31 17:45:52 UTC 2012
#8833: extract pluggable.php function logic into separate functions
--------------------------------------+-----------------------------
Reporter: wnorris | Owner: Viper007Bond
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Plugins | Version: 2.8
Severity: normal | Resolution:
Keywords: needs-patch dev-feedback |
--------------------------------------+-----------------------------
Changes (by johnbillion):
* keywords: needs-patch dev-feedback close => needs-patch dev-feedback
Comment:
I know there's not a lot of traction on this ticket, but I'd like to add a
bit of feedback (partly because it was recently mentioned again on
hackers).
With more than one plugin trying to override a given pluggable function,
there will only be one winner. The problem is that some of the pluggable
functions are too wide in scope, and two different plugins may be trying
to override the same pluggable function in its entirety just to change on
bit of its functionality.
I think many of the pluggable functions should be split into multiple
functions, with their individual bits of functionality being filterable.
This way, plugins can override (and "win") more tightly focused functions.
One example is `wp_mail()`, which does far more than just send an email.
It parses headers (including the 'from', 'cc' and 'bcc' fields), sets the
'from' name and address, sets content types, deals with charsets, adds
custom headers, adds attachments, and finally sends an email.
Changing this from from being pluggable to being filterable doesn't
overcome the issue where you may want to run multiple email-related
plugins at the same time, such as one which gives you HTML emails and one
which sends your emails through an email delivery service.
Another example is the various notification functions such as
`wp_notify_moderator()`, `wp_notify_postauthor()` and
`wp_new_user_notification()`. These functions have a mixture of logic in
them determining whether or not to send a notification, the notification
message itself, and additional stuff such as the 'from' headers in the
email. What a user cannot do, for example, is install one plugin to change
the text in these emails and another plugin which allows you to control
when and whether these notifications are sent.
A good first step would be to look at splitting some of these functions
up, and deciding which of the subsequent functions should have their
output filterable (eg. the text sent in notification emails) and which
should have their callback function filterable (eg. the function which
actually sends email).
I'd be willing to start looking at this over the next few weeks if it'll
get some traction.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8833#comment:24>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list