I am creating a website so that users can submit their articles from the front end. I have quite a few things set up:

  • The ability to submit custom post types from the front end
  • Blocked from the back-end.

I'd like to create a page (for logged in users) labeled "my posts" or my "submissions" that will show logged in users their own custom post post types and their status so that they know what's been published, what will be published in the future, pending, drafts (so they can go back and edit), and pending (so that I as Editor, know when an article is ready for my review).

I'm guess I'm looking for a frontend user dashboard. I've tried WP User Frontend, but it clashes with s2member and won't show posts from s2member registered users.

I just need something simple that will allow users easy access from the front end to manage their posts. I've been trying plugin after plugin and adding things to my short code creator but nothing works the way I need it to.

It doesn't have to be pretty, just a simple code that a non coder (like me) update per by custom post types.

To explain further, i'd like to have one code on a page shows the users all the deals they've submitted (and their status), and another code to show users all the articles they've submitted (and their status), etc.

Any help would be very useful

Thanks in advance!

1 Answer 1


I have Something that i use from time to time when i need something like that:

Plugin Name: List User Posts
Plugin URI: http://en.bainternet.info
Description: lists user posts on the front end
Version: 0.1
Author: Bainternet
Author URI: http://en.bainternet.info

if (!class_exists('list_user_posts')){
    * list_user_posts
    * @author Ohad Raz
    class list_user_posts
         * __construct class constructor
         * @author Ohad Raz
         * @param array $args
        function __construct($args = array())
            add_shortcode('user_posts', array($this,list_user_posts));

         * list_user_posts shortcode handler
         * @author Ohad Raz
         * @param  array  $attr    shortcode attributes
         * @param  string $content shortcode content
         * @return string
        public function list_user_posts($attr = array(), $content = null)
                    'post_type' => 'post',
                    'number' => 10,
                ), $attr));

            //if the user is not logged in the give him a link to log in
            if (!is_user_logged_in()){
                return sprintf(__('You Need to <a href="%s">Login</a> to see your posts'),wp_login_url(get_permalink()));
            //this is for pagination
            $pagenum = isset( $_GET['pagenum'] ) ? intval( $_GET['pagenum'] ) : 1;

            //get user's posts
            $args = array(
                'author' => get_current_user_id(), //this makes the query pull post form the current user only
                'post_status' => array('draft', 'future', 'pending', 'publish'),
                'post_type' => $post_type,
                'posts_per_page' => $number,
                'paged' => $pagenum
            $user_posts = new WP_Query( $args );

            $retVal = '';
            if ( $user_posts->have_posts() ) {

                //set table headers
                $retVal = '
                    <table class="user-posts-table" cellpadding="0" cellspacing="0">
                                <th>'.__( 'Title', 'lup' ).'</th>
                                <th>'.__( 'Status', 'lup' ).'</th>
                                <th>'.__( 'Actions', 'lup' ).'</th>
                //loop over and add each post to the table
                global $post;
                $temp = $post;
                while ($user_posts->have_posts()){
                    $title = $post->post_title;
                    $link = '<a href="'.get_permalink().'" title="'.sprintf( esc_attr__( 'Permalink to %s', 'lup' ), the_title_attribute( 'echo=0' ) ).'" rel="bookmark">'.$title.'</a>';
                    $retVal .= 
                                    '.( in_array( $post->post_status, array('draft', 'future', 'pending') ) ? $title : $link).'
                                    '.$post->post_status .'
                                    <a href="LINK_TO_YOUR_EDIT_PAGE"><span style="color: green;">'. __( 'Edit', 'lup' ).'</span></a>
                                    <a href="LINK TO YOUR DELETE PAGE"><span style="color: red;">'.__( 'Delete', 'lup' ).'</span></a>
                $retVal .= '</tbody></table>';

                //create pagination (if needed)
                if ($user_posts->found_posts > $number ){
                    $pagination = paginate_links( array(
                        'base' => add_query_arg( 'pagenum', '%#%' ),
                        'format' => '',
                        'prev_text' => __( '&laquo;', 'lup' ),
                        'next_text' => __( '&raquo;', 'lup' ),
                        'total' => $user_posts->max_num_pages,
                        'current' => $pagenum
                    if ( $pagination ) {
                        $retVal .= '<div class="pagination">'.$pagination .'</div>';
                //return table of posts
                return $retVal;
                //  no posts for this users found
                return  __("No Posts Found");

    }//end list_user_posts class
}//end if
new list_user_posts();

Its commented all over the place so you can understand whats going on there.

Usage simply create a page and add this shortcode: [user_posts] which will give you a list of posts by the logged in user.

You can also change the post type like so: [user_posts post_type="deal" number="5"]

  • Thank you! Where exactly am I supposed to insert this? am I adding this to an existing php file or creating a new one?
    – Trce
    Oct 26, 2012 at 22:09
  • This would go in your themes's functions.php file or in a plugin.
    – Bainternet
    Oct 27, 2012 at 7:29
  • Bainternet, thank you so much! This looks great only two issues: I'm not sure what to do with the Edit and delete buttons. I tried edit_post_link and delete_post_link, but these aren't working, Not sure what how I'm supposed to fix these. If I can't fix these edit and delete buttons I can't use this. Thanks in advance!
    – Trce
    Oct 27, 2012 at 17:12
  • Hmmm, the links should point to the pages where they can edit the posts or delete them, for example to delete wp-snippets.com/delete-post-from-front-end
    – Bainternet
    Oct 27, 2012 at 19:50
  • Thank you so much! I just used the .get_permalink($current), this leads them directly to the front end article and I have front end editor plug-in so it works. This is exactly what I needed. So thanks a bunch!
    – Trce
    Oct 28, 2012 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.