'; echo '

' . __( 'Advance user post CRUD', 'advance-user-post-crud' ) . '

'; $args = array( 'public' => true, ); $post_types = get_post_types($args); ?> $post_type_name) { if($post_type_name!="attachment"): ?> '100' ) ); $total_count = 0; $user_count=0; foreach($users->results as $data => $user) { $users_id = $user->data->ID; $users_name = $user->data->display_name; echo ''; global $wpdb; if(user_can( $users_id, 'upload_files' )): $attachment_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_author='".$users_id."'"); else: $attachment_count = 0; endif; echo ''; $user_capability = user_can( $users_id, 'publish_posts' ); $total_count1 = 0; foreach ($post_types as $key => $post_type_name) { if($post_type_name!="attachment"): $post_count = count_user_posts( $users_id , $post_type_name ); if($post_count !== '0'){ echo ''; }elseif($post_count==0){ $post_count=0; echo ''; } endif; $total_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author ='".$users_id."' AND (post_status = 'publish' OR post_status = 'inherit') AND post_type = '".$post_type_name."'"); $total_count1 = $total_count1 + $total_count; } echo ''; ?>
Total
'.$users_name.''.$attachment_count.''.$post_count.'0'.$total_count1.'
'; } function adv_user_crud_options() { if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.', 'advance-user-post-crud' ) ); } if(isset($_GET['user_id'])){ $user_id = intval(($_GET['user_id'])); $user_info = get_userdata($user_id); echo '
'; echo wp_sprintf( '

%s %s

', __( 'List of posts, pages and media published by', 'advance-user-post-crud' ), $user_info->user_login ); require('class/class-list-table.php'); $args = array( 'public' => true, ); $post_types = get_post_types($args); $flag = 0; $table_list = new Advance_User_Post_Table_List(); foreach ($post_types as $key => $post_type_name) { if( $post_type_name !="attachment" && count_user_posts( $user_id , $post_type_name)){ $flag = 1; echo '

'.$post_type_name.'

'; $table_list->post_type = $post_type_name ; $table_list->prepare_items(); $table_list->display(); } } $the_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'author' => $user_id) ); if ( $the_query->have_posts() ) { $flag = 1; echo '

Media

'; $table_list->post_type = 'attachment' ; $table_list->prepare_items(); $table_list->display(); } if(!$flag){ echo '

There is no post published by '.$user_info->user_login.'.

'; } ?>
ID . "'>" . __( 'View Profile', 'Click to see all published posts' ) . ""; return $actions; } function adv_user_crud_user_content($current_user, $userids){ echo '' . __( 'Click to see all published posts', 'advance-user-post-crud' ) . ''; } } $adv_user_crud_class = new adv_user_crud(); // add plugin option in dashboard add_action( 'admin_menu', array($adv_user_crud_class,'adv_user_crud_menu' )); add_action('login_enqueue_scripts', array($adv_user_crud_class,'adv_user_crud_scripts')); add_action( 'admin_enqueue_scripts', array($adv_user_crud_class,'adv_user_crud_scripts' )); //add link to user page add_filter('user_row_actions', array($adv_user_crud_class,'adv_user_crud_frontend_profile_action_link'), 11, 2); //add plugin page link when we click on user delete link add_action('delete_user_form',array($adv_user_crud_class,'adv_user_crud_user_content'),10,2);