[wp-hackers] add_meta_box without checked?
John Blackbourn
johnbillion+wp at gmail.com
Fri May 1 21:44:57 GMT 2009
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
>
More information about the wp-hackers
mailing list