[wp-trac] [WordPress Trac] #8833: extract pluggable.php function logic into separate functions

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 9 21:24:16 GMT 2009


#8833: extract pluggable.php function logic into separate functions
-------------------------+--------------------------------------------------
 Reporter:  wnorris      |       Owner:     
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  2.8
Component:  Plugins      |     Version:     
 Severity:  normal       |    Keywords:     
-------------------------+--------------------------------------------------
 Currently, when a plugin overrides one of the pluggable.php functions with
 a custom implementation, there is no way to fall back to the standard
 version of the function.  Instead, plugin authors have to copy and paste
 all of the logic from pluggable.php into their custom function.  I'd love
 to see the actual logic separated out into "private" functions that are
 simply called the public ones.  For example:

 {{{
 if (!function_exists('wp_get_current_user')) {
     function wp_get_current_user() {
         return _wp_get_current_user();
     }
 }

 function _wp_get_current_user() {
     /* normal logic for getting the current user */
 }
 }}}

 This would allow me to override the function, but still fallback to the
 standard implementation if I need to...

 {{{
 if (!function_exists('wp_get_current_user')) {
     function wp_get_current_user() {
         if ( /* some condition */ ) {
             /* my own custom get current user logic */
         } else {
             return _wp_get_current_user();
         }
     }
 }
 }}}

 This wouldn't actually take that much work, and I'm happy to do it.  Not
 sure if it would be best to keep it all in pluggable.php, or if the
 standard implementations should be moved to pluggable.standard.php or
 something similar. ??

 Original wp-hackers thread: http://groups.google.com/group/wp-
 hackers/browse_thread/thread/31295f83a13dc025

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8833>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list