[wp-hackers] add_meta_box without checked?
Frank Bueltge
frank at bueltge.de
Fri May 1 20:18:43 GMT 2009
@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
);
}
}
More information about the wp-hackers
mailing list