[wp-trac] [WordPress Trac] #12732: Bulk Actions needs to allow custom bulk actions

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 27 16:40:16 UTC 2010


#12732: Bulk Actions needs to allow custom bulk actions
--------------------------+-------------------------------------------------
 Reporter:  ptahdunbar    |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  3.0       
 Severity:  normal        |    Keywords:  has-patch 
--------------------------+-------------------------------------------------

Comment(by TobiasBg):

 Wouldn't it be nicer to abstract the current HTML on each of those bulk
 action <select> boxes in an array, like

 {{{
 $bulk_actions = array (
     'delete' => __( 'Delete' ),
     'spam' => __( 'Mark as Spam' )
 );
 }}}

 That array could then be run through a filter, where I could just add an
 element to that array - which is nicer than having to echo my own HTML in
 a do_action call. It would also have the advantage, that existing bulk
 actions could be removed through that filter, if desired.

 And finally, the array could be printed to the page by a generic function
 (which could even be used on all of those bulk action <select> boxes, e.g.
 like

 {{{
 function wp_bulk_action_select_box( $actions ) {
   echo "<select>";
   foreach ( $actions as $value => $text ) {
     echo "<option value='{$value}'>{$text}</option>";
   }
   echo "</select>";
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12732#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list