[wp-trac] [WordPress Trac] #40379: newticket#ticket

WordPress Trac noreply at wordpress.org
Fri Apr 7 04:46:31 UTC 2017


#40379: newticket#ticket
--------------------------+------------------------------
 Reporter:  adminhoang    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------
Changes (by SergeyBiryukov):

 * focuses:  javascript, docs, administration, template => administration


Old description:

> //Fetch ALL dashboard widget options from the db...
>     $opts = get_option( 'dashboard_widget_options' );
>
>     //Get just our widget's options, or set empty array
>     $w_opts = ( isset( $opts[$widget_id] ) ) ? $opts[$widget_id] :
> array();
>
>     if ( $add_only ) {
>         //Flesh out any missing options (existing ones overwrite new
> ones)
>         $opts[$widget_id] = array_merge($args,$w_opts);
>     }
>     else {
>         //Merge new options with existing ones, and add it back to the
> widgets array
>         $opts[$widget_id] = array_merge($w_opts,$args);
>     }
>
>     //Save the entire widgets array back to the db
>     return update_option('dashboard_widget_options', $opts);
> }

New description:

 {{{
  //Fetch ALL dashboard widget options from the db...
     $opts = get_option( 'dashboard_widget_options' );

     //Get just our widget's options, or set empty array
     $w_opts = ( isset( $opts[$widget_id] ) ) ? $opts[$widget_id] :
 array();

     if ( $add_only ) {
         //Flesh out any missing options (existing ones overwrite new ones)
         $opts[$widget_id] = array_merge($args,$w_opts);
     }
     else {
         //Merge new options with existing ones, and add it back to the
 widgets array
         $opts[$widget_id] = array_merge($w_opts,$args);
     }

     //Save the entire widgets array back to the db
     return update_option('dashboard_widget_options', $opts);
 }
 }}}

--

Comment:

 Hi @adminhoang, welcome to WordPress Trac!

 This Trac is used for enhancements and bug reporting for the WordPress
 core software.

 Could you clarify what you are trying to do?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40379#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list