add_filter('manage_users_columns', 'drop_video_columns_head');
function drop_video_columns_head($defaults_columns) {
unset($defaults_columns['posts']);
unset($defaults_columns['name']);
$defaults_columns['uservideos'] = 'Videos';
return $defaults_columns;
}
add_filter('manage_users_custom_column', 'drop_video_columns_content_users', 10, 3);
function drop_video_columns_content_users($c, $column_name, $user_id){
if ($column_name == 'uservideos') {
global $wpdb;
$num_videos = $wpdb->get_results("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'youtube' AND post_status = 'publish' and post_author = {$user_id} ",'ARRAY_A');
return $num_videos[0]['COUNT(*)'];
}
}
function drop_video_columns_head($defaults_columns) {
unset($defaults_columns['posts']);
unset($defaults_columns['name']);
$defaults_columns['uservideos'] = 'Videos';
return $defaults_columns;
}
add_filter('manage_users_custom_column', 'drop_video_columns_content_users', 10, 3);
function drop_video_columns_content_users($c, $column_name, $user_id){
if ($column_name == 'uservideos') {
global $wpdb;
$num_videos = $wpdb->get_results("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'youtube' AND post_status = 'publish' and post_author = {$user_id} ",'ARRAY_A');
return $num_videos[0]['COUNT(*)'];
}
}
No comments:
Post a Comment