[wp-hackers] add_meta_box without checked?

Alan Castonguay alan at verselogic.net
Sun May 3 12:43:10 GMT 2009


Frank,

This SQL will only run on activation of the plugin. The speed of this  
SQL is not nearly as important as manageability.

However, get_hidden_meta_boxes() uses get_user_option() which is based  
on the current user, so this is actually going to blow away everyone  
else's preferences with respect to hidden boxes.

Why don't you filter on get_user_option_meta-box-hidden_page and  
get_user_option_meta-box-hidden_post?


Alan J Castonguay


-------------- next part --------------


On May 1, 2009, at 6:11 PM, Frank Bueltge wrote:

> Thanks John,
> I think get_users_of_blog() is little bid bogger, more datas and my  
> sql is
> faster for this. I will only the ID.
>
> Thanks a lot for your time and help!
>
> Best regards
> Frank
>
> __
> Das Buch: WordPress - Weblogs einrichten und administrieren, Open  
> Source
> Press
> ISBN 978-3-937514-33-8
> http://wordpress-buch.bueltge.de/das-buch/
>
> http://bueltge.de : frank at bueltge.de
> http://wpengineer.com : frank at wpengineer.com
> __
> Frank B?ltge
> Tel:    +49 3691 212951
> Mobil:  +49 170 5322053
> E-Mail: f.bueltge at inpsyde.com
>
> Inpsyde GmbH
> Mutzer Heide 3
> 51467 Bergisch Gladbach
>
> Steuernr: 204/5756/0999 Steueridentnr.: DE263849534
> Gesch?ftsf?hrender Gesellschafter: H. Roh? HRB 65224 Amtsgericht K?ln
>
> http://inpsyde.com
> http://pressthis.de
>
>
> On Fri, May 1, 2009 at 11:44 PM, John Blackbourn
> <johnbillion+wp at gmail.com<johnbillion%2Bwp at gmail.com>
>> wrote:
>
>> Looks good Frank. You could also use get_users_of_blog() instead of
>> your SQL query.
>>
>> John.
>>
>> 2009/5/1 Frank Bueltge <frank at bueltge.de>:
>>> @John and scribu:
>>> i have no found a other solution as set the user_meta_dat for  
>>> this. I
>> have
>>> write a small function to write the usermeta on activate the plugin.
>> Please
>>> -waht do you think about this?
>>>
>>> register_activation_hook( __FILE__, array(&$this, 'install') );
>>>       function install() {
>>>           global $wpdb;
>>>
>>>           $wp_users = $wpdb->get_results(
>>>
>>> $wpdb->prepare(
>>>
>>>               "SELECT ID
>>>
>>>                FROM   $wpdb->users
>>>
>>>                ORDER  BY ID"
>>>
>>>               )
>>>                                                               );
>>>
>>>           $hidden_page = array();
>>>           $hidden_post = array();
>>>           $hidden_page = get_hidden_meta_boxes('page');
>>>           $hidden_post = get_hidden_meta_boxes('post');
>>>           array_push( $hidden_page, 'mygermancityfacts' );
>>>           array_push( $hidden_post, 'mygermancityfacts' );
>>>           foreach ( $wp_users as $user ) {
>>>               $userID = (int) $user->ID;
>>>               update_usermeta( $userID, 'metaboxhidden_page',
>> $hidden_page
>>> );
>>>               update_usermeta( $userID, 'metaboxhidden_post',
>> $hidden_post
>>> );
>>>           }
>>>       }
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list