The latest version of the Post Levels Plugin is now available.

Download

Post Levels Version 1.1

Installation

  1. Save the post-levels.php file in your wp-content/plugins directory.
  2. Activate the plugin through your WordPress admin area (See the official documentation if you need more help with this.)
  3. Go to the Users section of your admin area, then go to User Levels. Give levels to your users
  4. Make posts private when writing or editing by using the Post Level drop down, and setting the Post Status to Private

New Features

  • Private Pages: Support for private pages, just like posts
  • Previews for Private Posts: This has been requested often — you can now show a preview for your private posts (even shows up in RSS!). The preview can be just the title, or the title and the post excerpt.
  • Private Posts in archive counts: Another frequently-requested item
  • Private posts (usually) show up in category counts: This works in most themes. Let me know if yours doesn’t (make sure you tell me which theme!)
  • No more HTTP Auth: This fixes the issue some people saw with password prompts. I’ll replace this feature in the next version
  • WordPress 2.1 compatibility: Most of the new features don’t work with older versions of WP — sorry.

Donate

If you’re feeling generous, go for it:

30 Comments

  1. scorbs
    February 4, 2007 Link to this

    Great plugin. I gave five dollars. :)

    Are you planning on supporting Extended Live Archvies? http://www.sonsofskadi.net/extended-live-archive/

    I use it with my K2 theme… Thanks!

  2. February 7, 2007 Link to this

    Hi,
    thanks for your plugin , i was looking for elliot’s one (subscribers only) but it seems that it doesn’t work for wp 2.1 anymore and he took it down.Luckly i can use yours now.
    The “Preview for Private Posts” feature in very good, i’d give you a tip :use the part before the “” as preview instead of the excerpt,this way you can use html code and insert images for example.
    Hi and thanks again.

  3. February 7, 2007 Link to this

    ok the “” is a “more” ,the one you use in wordpress to cut “the rest of the article” out from the home page.

  4. Nick
    February 7, 2007 Link to this

    Hi, I just installed this plugin on a fresh install of Wordpress 2.1. I notice that whenever I set an article as private, it automatically prefixes the title of that article as “Private:” eventhough in the Post Levels Configuration, there is nothing in the field marked “Private Post Title Prefix.” I can’t seem to figure out how to remove this prefix from titles.

  5. February 7, 2007 Link to this

    @Gas — Do you mean use the part of the post before the “see the rest of this post” that happens after [!--more--] in the post?

    @Nick — I investigated, and it looks like WordPress by default is adding the “Private: ” independent of my setting. I’ve updated the plugin to fix this issue. Go ahead and re-download it and tell me if your problem is fixed.

  6. Nick
    February 7, 2007 Link to this

    Works like a charm fil! Thanks for the fast response. Going to donate a little for a plugin that’s going to work wonders for my new subscription-based blog.

  7. Jenna
    February 8, 2007 Link to this

    I’m having a problem with the Post Preview option. I can’t seem to make it work with default, K2 or Integral themes. I’m wondering if I did something wrong?

  8. Charlie
    February 8, 2007 Link to this

    Private posts aren’t showing up for me. The theme I am using is Waterlily. It can be found at http://ewebscapes.com/ Thanks for the terrific plugin. It makes life so much better.

  9. Jenna
    February 8, 2007 Link to this

    I suppose I should say that I am using the WP 2.1 and K2 0.95rc1.

  10. February 8, 2007 Link to this

    @Nick: Thanks! :)

    @Jenna — Can you be more specific? What isn’t working? Do private posts not show up at all? Is the type of preview incorrect?

    The post preview is only when you are not logged into the site, so make sure you’ve completely logged out of WordPress (or use a different browser or computer).

    @Charlie: Could you also be more specific? Do they show up for you (the admin?), or for other logged in users? Or are they always hidden? Also, make sure that you’ve set a post level on the post (there is a drop down on the page where you write a post).

  11. Jenna
    February 8, 2007 Link to this

    Here’s what I’m doing:

    I selected “Title plus excerpt” under Post Preview. I created a new entry called “New Entry” and set the Post Level to 3. Then I hit Publish.

    When I click over (still logged in) to make sure the entry is published, I see it says “Moderated: New Entry” and my post body is visible.

    Then I signed out of WordPress and clicked back over. The moderated post disappears and I get the last unmoderated post at the top. That post is duplicated seven times. The next one is duplicated two times. The third and subsequent are only duplicated once.

    I also clicked over into IE to test it. Same results.

    Note: This is a fresh installation of WP 2.1 and I only have two plugins installed; this one and UTW 3.14. I deactivated UTW for the time being to make sure that it was not causing a problem.

  12. February 8, 2007 Link to this

    Any idea what the plugin might be causing the weird effects I’m seeing on my sight right now, with the following error showing up in in the main posts area (as well as other stuff elsewhere):

    WordPress database error: [Lost connection to MySQL server during query]
    SELECT * FROM eclx_attached_files_meta WHERE post_id = 2961 ORDER BY file_name ASC

    When I deactive Post Levels 1.1, it goes away. (But so do post levels.)

    Think it’s a plugin conflict? Maybe the Page Restriction Plugin? (I’m scared to fiddle since some of the code for that one is hardcoded into the template or something.)

  13. February 8, 2007 Link to this

    Whoops, solved it myself. For the record, the old Attachfile plugin (of which there may be a new one, but since I don’t use it anymore, it’s toast) was having a conflict with the new PostLevels 1.1.

    Take care, and thanks very much for the wonderful update!

  14. February 8, 2007 Link to this

    Jenna — thanks for the detailed explanation! I have to admit, I’m a little bit baffled by your issue. A couple of more questions:

    - Could you make sure you have the latest version of the plugin (I updated it a couple of days after this post) — go ahead and re-download it to see if it fixes the issue

    - What do you mean by a “Moderated” post? Is that a private one?

    - When you saw seven duplicate copies of the same post — were you logged in?

    - For that post with seven copies, how many tags does it have?

    Thanks!

  15. February 9, 2007 Link to this

    I was wrong. Post-Levels is causing some kind of weird effect on my page. (When I turn Post-Levels off, this goes away, and when I turn it on, it happens again).

    On this page:

    http://www.gordsellar.com/2007/02/05/dads-anniversary/

    I get this effect (with some normal next left in so you can see where what is happening):

    WordPress database error: [Lost connection to MySQL server during query]
    SELECT * FROM eclx_comments WHERE comment_post_ID = ‘2951′ AND comment_approved = ‘1′ ORDER BY comment_date

    Comment on this post below

    Logged in as gordsellar. Logout »

    You can leave a response, or trackback from your own site. Edit this entry.

    WordPress database error: [MySQL server has gone away]
    SELECT ID, post_title FROM (eclx_posts LEFT JOIN eclx_postmeta ON eclx_posts.ID = eclx_postmeta.post_id) WHERE post_date ‘2007-02-05 06:50:28′ AND post_type = ‘post’ AND (eclx_posts.post_status = ‘publish’ OR (eclx_posts.post_status = ‘private’ AND (eclx_postmeta.meta_key = ‘post_level’ AND eclx_postmeta.meta_value

    Somehow, it’s messing up the handling of comments, or, at least, that’s my guess. Thoughts? (I’ll leave the messed-up page up so you can see it.)

  16. Charlie
    February 9, 2007 Link to this

    Sorry about that. The posts are getting marked properly as private and whatnot, based upon the post level. The posts aren’t showing up in the categories unless they are marked public. The posts do not show up in the categories for any user, including the administrator. Is this just something that needs to be modified in the theme?
    Thanks

  17. Charlie
    February 9, 2007 Link to this

    Sorry to post again, but I just noticed something else. This only happens with 1.1 final and not with either of the betas. When a user is logged in, the posts appear in a strange order. The public posts are first, going in reverse order, so the oldest are at the beginning. Then the private ones appear, also in reverse order. The posts appear correctly when the plugin is deactivated.

    Thanks for the help.

  18. February 9, 2007 Link to this

    The duplicate posts are gone, but they are now shown in reverse order and now several copies of categories are showing. I made one category protected. The site loads slower, but I think that might be because of the reverse chronological ordering.

  19. February 10, 2007 Link to this

    Would you like me to install it on a testblog on my site with all the same plugins installed, so that this problem with messed up comments can be investigated? For the moment, just to let my site run like normal, I’ve had to disable the Postlevels plugin.

    Sorry for the bad news and so on.

  20. February 10, 2007 Link to this

    Wow! These are some strange problems. Could you guys tell me which plugins & theme you’re running so I can install them on my test blogs? Thanks!

  21. Charlie
    February 10, 2007 Link to this

    I am running the Random Quotes plugin (http://www.zombierobot.com/wp-quotes/) and Wordpress Database Backup plugin (http://www.skippy.net/blog/plugins/). The theme I am running is the Waterlily theme that I specified earlier. I have made slight modifications to the theme, but the posts are still reversed on the default theme so I don’t think that is the problem.

  22. February 11, 2007 Link to this

    For anyone who may be experiencing the following error:
    [Not unique table/alias: 'wp_postmeta']

    You probably have some SQL that was already joining on the postmeta table to filter out private posts. This functionality is now built into the plugin, so the LEFT JOIN is being performed twice on execution of the query (hence the ambiguity of any wp-postmeta table references).

    As an example, here is my SQL for displaying recent comments (note that I no longer have to worry about post levels):

    SELECT {$wpdb->comments}.comment_ID, {$wpdb->comments}.comment_author, {$wpdb->comments}.comment_date, {$wpdb->posts}.id, {$wpdb->posts}.post_title
    FROM {$wpdb->comments}, {$wpdb->posts}
    WHERE {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.id AND
    {$wpdb->comments}.comment_approved=’1′ AND
    {$wpdb->comments}.comment_type != ‘pingback’ AND
    {$wpdb->posts}.post_status = ‘publish’
    ORDER BY comment_ID DESC LIMIT 5

    IMPORTANT NOTE: Make sure that when you write the table name ” {$wpdb->posts} ” in the FROM clause you ALWAYS put a space on BOTH sides!! This bug will probably go away in future versions, but for now it’s critical if you want to see the private comments.

  23. February 12, 2007 Link to this

    The plugin is so nice and usefull! Really congrats for your work.. But still the problem with the private posts not showing up in the categories and archives when using a plugin that expand categories (WP-dTree is the plugin) and archives to detailed posts is making the users confused..
    Really ill be so happy if this would be solved in the future! Again thanks for your plugin..

  24. February 12, 2007 Link to this

    Hi is there any possebility to set for a role a fixed publish-level? By that I mean, that the use has not to choose each time the post-level, further he alway post in a prefixed level?

  25. Pepe
    February 13, 2007 Link to this

    I have the follow error code:

    *************************************************

    WordPress database error: [Not unique table/alias: 'wp_postmeta']
    SELECT post_id, meta_value FROM wp_postmeta, (wp_posts LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id) WHERE post_id = ID AND meta_key = ‘links_to’ AND (post_status = ’static’ OR (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (wp_postmeta.meta_key = ‘post_level’ AND wp_postmeta.meta_value

  26. Nate
    February 14, 2007 Link to this

    I have installed the plugin, I am guessing that it works, but when I view the protected page as non-registered user it takes me to my “Not Found
    Sorry, but you are looking for something that isn’t here” page. Anyway have the plugin direct the non-registered user to page that says “must be logged in to view this post/page?” Thank you for your time and for creating this plugin!

    Take care.

  27. Nate
    February 14, 2007 Link to this

    oops. just noticed the following database error: “WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    select restricted from wp_posts where ID=” so forget or delete the above.

  28. perine
    February 14, 2007 Link to this

    I have the same problem as Charlie. My posts show up in reversed order. Changing a theme or deactivating other plugins does nothing to help. Only deactivating this post-level plugin brings the posts back to the correct order. I hope you can find a fix for this as this is a great plugin otherwise.

  29. February 16, 2007 Link to this

    Post Levels 1.1.1…

    Post Levels 1.1.1 is a bugfix release that will (hopefully) get rid of some of the problems people have been seeing with the 1.1 release.
    Download
    Post Levels 1.1.1
    New Features

    Use the post teaser as the preview: You can now show the post teaser as t…

  30. February 16, 2007 Link to this

    Hello all, I’ve posted an updated version that will hopefully help some of these issues. There are a lot of different themes and plugins out there, so it’s tough to get everything right!

    Post Levels 1.1.1