Version 0.2 of the Post Levels plugin has been released.

Changes:

Two new functions were added:

  • is_private: Returns true if the current post is private (this follows the same model as the other “is” functions)
  • is_post_level($level): Returns true if the current post’s level is equal to $level, which defaults to 0

Download

Post Levels Plugin v0.2

Install

Installation instructions

Using the New Functions

An example for using the is_private() function is shown below:

<?php if (function_exists('is_private') && is_private()) : ?>
  <span class="private">(private)</span>
<?php endif;?>

It is good style to check if the function exists before calling, in case the plugin is disabled for some reason.

71 Comments

  1. Chrissy
    February 19, 2005 Link to this

    After I installed this plugin, an error I’ve never seen before appeared when I wished to manage posts:

    Fatal error: Call to undefined function: filter_posts() in /home/aelyssir/public_html/wp/wp-blog-header.php on line 258

    Could this be due to the plugin and how can it be fixed?

  2. Chrissy
    February 19, 2005 Link to this

    After I installed this plugin, an error I’ve never seen before appeared when I wished to manage posts:

    Fatal error: Call to undefined function: filter_posts() in /home/aelyssir/public_html/wp/wp-blog-header.php on line 258

    Could this be due to the plugin and how can it be fixed?

  3. Chrissy
    February 19, 2005 Link to this

    Nevermind! I fixed the problem, by myself. I had been using the ViewLevel plugin before and I had forgotten to change the last line in wp-blog-header.php. Thanks for plugin!

  4. Chrissy
    February 19, 2005 Link to this

    Nevermind! I fixed the problem, by myself. I had been using the ViewLevel plugin before and I had forgotten to change the last line in wp-blog-header.php. Thanks for plugin!

  5. Carla
    February 28, 2005 Link to this

    I installed the plugin and it appears that users are directed to the dashboard and can even post in a blog once they are registered. How do I solve this? Thanks. :)

  6. Carla
    February 28, 2005 Link to this

    I installed the plugin and it appears that users are directed to the dashboard and can even post in a blog once they are registered. How do I solve this? Thanks. :)

  7. March 1, 2005 Link to this

    Carla: What you’re seeing is actually an issue with the WordPress login system, it auto-directs people to the dashboard. If you know PHP, you can edit this in code — but I don’t know of a way to do this from my plug in.

  8. March 1, 2005 Link to this

    Carla: What you’re seeing is actually an issue with the WordPress login system, it auto-directs people to the dashboard. If you know PHP, you can edit this in code — but I don’t know of a way to do this from my plug in.

  9. Carla
    March 2, 2005 Link to this

    Ok, I can figure that out but what about their ability to post?

  10. Carla
    March 2, 2005 Link to this

    Ok, I can figure that out but what about their ability to post?

  11. March 2, 2005 Link to this

    There’s no perfect way (WordPress fails here a bit), but if you edit the beginning of menu.php, you can change the minimum level of each section in the admin area.

  12. March 2, 2005 Link to this

    There’s no perfect way (WordPress fails here a bit), but if you edit the beginning of menu.php, you can change the minimum level of each section in the admin area.

  13. giles
    March 5, 2005 Link to this

    Ok I am a little dumb yes … my last post was asking about the sample php code

    (private)

    which I have slipped into my theme index.php like so

    “>” style=”text-decoration:none;” rel=”bookmark” title=”Permanent Link: “>

    (private)

    ,

    But I was expecting it to tell users who were not logged in that there is a private post there. But it doesn’t is this a WP1.5 issue, and I can’t wait for the new release the plans you have for it sound awesome ;)

  14. giles
    March 5, 2005 Link to this

    Ok I am a little dumb yes … my last post was asking about the sample php code

    (private)

    which I have slipped into my theme index.php like so

    “>” style=”text-decoration:none;” rel=”bookmark” title=”Permanent Link: “>

    (private)

    ,

    But I was expecting it to tell users who were not logged in that there is a private post there. But it doesn’t is this a WP1.5 issue, and I can’t wait for the new release the plans you have for it sound awesome ;)

  15. giles
    March 5, 2005 Link to this

    Ok that last post obviously is messed up.

    Ok so the sample php simply lets the reader know if they are logged in that the post is private ….

    this is my last and really my only question as i struggle to exmplain myself … what I also want ontop of this great feature is to let any users who are not logged in that there is a private post, and of they would like to see it they should log in or email me ….. here is a clip froma screen shot of a website that does it … does anyone know what it is you do to make this happen ?

    URL removed by comment author request

  16. giles
    March 5, 2005 Link to this

    Ok that last post obviously is messed up.

    Ok so the sample php simply lets the reader know if they are logged in that the post is private ….

    this is my last and really my only question as i struggle to exmplain myself … what I also want ontop of this great feature is to let any users who are not logged in that there is a private post, and of they would like to see it they should log in or email me ….. here is a clip froma screen shot of a website that does it … does anyone know what it is you do to make this happen ?

    URL removed by comment author request

  17. March 5, 2005 Link to this

    Giles: The plugin doesn’t support that, and that’s purposeful. It was designed such that non-privileged users would never even know what they’re missing. Adding that support isn’t particularly straightforward due to the way the feature works. The view level plugin (if it’s ever update) would support what you’re looking for. You should also check the WordPress Forums in case some one has done this already.

  18. March 5, 2005 Link to this

    Giles: The plugin doesn’t support that, and that’s purposeful. It was designed such that non-privileged users would never even know what they’re missing. Adding that support isn’t particularly straightforward due to the way the feature works. The view level plugin (if it’s ever update) would support what you’re looking for. You should also check the WordPress Forums in case some one has done this already.

  19. giles
    March 6, 2005 Link to this

    thanks for the reply fil … but i wanted to try the view level plugin .. but the website is down and i can’t find it available anywhere else :( Thanks for your insite.

  20. giles
    March 6, 2005 Link to this

    thanks for the reply fil … but i wanted to try the view level plugin .. but the website is down and i can’t find it available anywhere else :( Thanks for your insite.

  21. giles
    March 6, 2005 Link to this

    apparently your plug in is the only one that is being updated anymore, and people that made other plugins think yours is better anyway.
    I was really hoping in the index or whatever file I could just write some code like

    it’s nice to get a reply even if nope can’t do this. I won’t give up and hopefully I will get a solution to what I want sometime.

  22. giles
    March 6, 2005 Link to this

    apparently your plug in is the only one that is being updated anymore, and people that made other plugins think yours is better anyway.
    I was really hoping in the index or whatever file I could just write some code like

    it’s nice to get a reply even if nope can’t do this. I won’t give up and hopefully I will get a solution to what I want sometime.

  23. March 6, 2005 Link to this

    Giles: I’ll add your request to the to-do list, but it’s a lower priority than getting better UI and RSS feed support (which more people are requesting)

  24. March 6, 2005 Link to this

    Giles: I’ll add your request to the to-do list, but it’s a lower priority than getting better UI and RSS feed support (which more people are requesting)

  25. Shelby
    March 8, 2005 Link to this

    fil, what kind of UI are you trying to add? Also yeah it would be cool to be able to config the plugin more. Have some check boxes to enable a lock picture or not too. Also to show to public that there is a private post or not show … just some stuff to toggle.

  26. Shelby
    March 8, 2005 Link to this

    fil, what kind of UI are you trying to add? Also yeah it would be cool to be able to config the plugin more. Have some check boxes to enable a lock picture or not too. Also to show to public that there is a private post or not show … just some stuff to toggle.

  27. Dinh
    March 11, 2005 Link to this

    Hi, I was wondering if there is a way for the categories/calendar to display correctly for people who are privileged. (Right now, it only shows public posts, even for people who can see the private ones.)

  28. Dinh
    March 11, 2005 Link to this

    Hi, I was wondering if there is a way for the categories/calendar to display correctly for people who are privileged. (Right now, it only shows public posts, even for people who can see the private ones.)

  29. March 11, 2005 Link to this

    Dinh: This is a known issue, and it’s currently a limitation in WordPress’ plug-in architecture

  30. March 11, 2005 Link to this

    Dinh: This is a known issue, and it’s currently a limitation in WordPress’ plug-in architecture

  31. Anne
    March 13, 2005 Link to this

    I was wondering if there is a way so logged in users can see the private posts. At the moment I’m the only one that sees that because I am the highest user level. But I would like to change it so users with user level > 1 can see them

  32. Anne
    March 13, 2005 Link to this

    I was wondering if there is a way so logged in users can see the private posts. At the moment I’m the only one that sees that because I am the highest user level. But I would like to change it so users with user level > 1 can see them

  33. crash
    March 21, 2005 Link to this

    hello all

    i’ve made an enhancer plugin for Post Levels. if anyone is interested, it is here -> http://idlemind.org/journal/projects/post-levels_enhancer/

  34. crash
    March 21, 2005 Link to this

    hello all

    i’ve made an enhancer plugin for Post Levels. if anyone is interested, it is here -> http://idlemind.org/journal/projects/post-levels_enhancer/

  35. Becca
    March 26, 2005 Link to this

    Thanks for this. :) Just wanted to say that it’s working like a charm for me.

  36. Becca
    March 26, 2005 Link to this

    Thanks for this. :) Just wanted to say that it’s working like a charm for me.

  37. Ludwig
    April 20, 2005 Link to this

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 6

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 7

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 8

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 9

    Got this error with enhancer, and no spaces before or after the s

  38. Ludwig
    April 20, 2005 Link to this

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 6

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 7

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 8

    Warning: Cannot modify header information - headers already sent by (output started at /home/pingo1/public_html/wp-content/plugins/post-levels_enhancer.php:201) in /home/pingo1/public_html/wp-admin/admin.php on line 9

    Got this error with enhancer, and no spaces before or after the s

  39. April 20, 2005 Link to this

    Ludwig: You should contact the author of the enhancer for your error.

  40. April 20, 2005 Link to this

    Ludwig: You should contact the author of the enhancer for your error.

  41. Valerie
    May 6, 2005 Link to this

    So… if I set the level of the post as 0, which is default, it does nothing and everyone can see it? Or is it seen by those who are registered but have a level of 0 or above?

    Thank you, by the way, this is solving quite a bit of problems for me. :-)

  42. Valerie
    May 6, 2005 Link to this

    So… if I set the level of the post as 0, which is default, it does nothing and everyone can see it? Or is it seen by those who are registered but have a level of 0 or above?

    Thank you, by the way, this is solving quite a bit of problems for me. :-)

  43. Secure pages?
    May 8, 2005 Link to this

    Can a page be secured by this plugin? I hate the password feature and would like the same functionality for pages like this have for posts.

    Best regards
    Stian B. Barmen

  44. Secure pages?
    May 8, 2005 Link to this

    Can a page be secured by this plugin? I hate the password feature and would like the same functionality for pages like this have for posts.

    Best regards
    Stian B. Barmen

  45. Shelby
    May 10, 2005 Link to this

    It wont work with the new wordpress 1.5.1 … it gives errors. Any idea on when this will work with it? Thanks

  46. Shelby
    May 10, 2005 Link to this

    It wont work with the new wordpress 1.5.1 … it gives errors. Any idea on when this will work with it? Thanks

  47. May 10, 2005 Link to this

    1.5.1 just came out and I haven’t had a chance to test the plugin on it. Could you give some more detail about the error?

    I hope to update the plugin some time this weekend (the day job is keeping me quite busy).

  48. May 10, 2005 Link to this

    1.5.1 just came out and I haven’t had a chance to test the plugin on it. Could you give some more detail about the error?

    I hope to update the plugin some time this weekend (the day job is keeping me quite busy).

  49. bishop
    May 10, 2005 Link to this

    i also got an error when i upgraded to wp 1.5.1
    here the error message:

    Fatal error: Call to undefined function: get_currentuserinfo() in /home/www/htdocs/stefan-goehring.net/glatzopatzo/wp-content/plugins/post-levels.php on line 20

    i use some other plugins which use that function and i don’t get an error from them. perhaps there is an include or require missing??

  50. bishop
    May 10, 2005 Link to this

    i also got an error when i upgraded to wp 1.5.1
    here the error message:

    Fatal error: Call to undefined function: get_currentuserinfo() in /home/www/htdocs/stefan-goehring.net/glatzopatzo/wp-content/plugins/post-levels.php on line 20

    i use some other plugins which use that function and i don’t get an error from them. perhaps there is an include or require missing??

  51. May 10, 2005 Link to this

    Bishop: Which plugins use that function and still work on 1.5.1?

  52. May 10, 2005 Link to this

    Bishop: Which plugins use that function and still work on 1.5.1?

  53. Shelby
    May 10, 2005 Link to this

    thats the same error I am getting. I dont know what other plugins use that, so I am of no help. And also fil if you are planning on working on it this weekend, any chance you can make a button to “make Private” when posting so you dont have to add post_level=x

  54. Shelby
    May 10, 2005 Link to this

    thats the same error I am getting. I dont know what other plugins use that, so I am of no help. And also fil if you are planning on working on it this weekend, any chance you can make a button to “make Private” when posting so you dont have to add post_level=x

  55. crash
    May 10, 2005 Link to this

    the problem is that get_currentuserinfo() is now part of “plugga ble functions,” which “/* These functions can be replaced via plugins. They are loaded after plugins are loaded. */”

    since the function is loaded AFTER the plugin, it’s not defined at the time of plugin execution

  56. crash
    May 10, 2005 Link to this

    the problem is that get_currentuserinfo() is now part of “plugga ble functions,” which “/* These functions can be replaced via plugins. They are loaded after plugins are loaded. */”

    since the function is loaded AFTER the plugin, it’s not defined at the time of plugin execution

  57. bishop
    May 11, 2005 Link to this

    i found out the same as crash but i couldn’t solve the problem, so i downgraded to 1.5 again and it works fine again.

    @fil: i found the function get_currentuserinfo() in the plugin WYSI-Wordpress, but it is imho only executed when writing or editing an article.
    i tried including / requiring the pluggable…php file (just try and error not really knowing what i’m doing) in the post-levels.php but didn’t work. i also copied the function directly in your plugin but didn’t work either…

  58. bishop
    May 11, 2005 Link to this

    i found out the same as crash but i couldn’t solve the problem, so i downgraded to 1.5 again and it works fine again.

    @fil: i found the function get_currentuserinfo() in the plugin WYSI-Wordpress, but it is imho only executed when writing or editing an article.
    i tried including / requiring the pluggable…php file (just try and error not really knowing what i’m doing) in the post-levels.php but didn’t work. i also copied the function directly in your plugin but didn’t work either…

  59. tatatee
    May 12, 2005 Link to this

    Hey, I’m also getting that error.

    Part of the code where it says “In case we’re running stand-alone…” I removed that, and the corresponding “}” and “else…” codes but then the posts functioned as private posts.

    Since 1.5.1 is supposed to fix some security loopholes I decided to stick with the upgrade, and have uninstalled this plugin.

    Hope you can find a fix soon =)

  60. tatatee
    May 12, 2005 Link to this

    Hey, I’m also getting that error.

    Part of the code where it says “In case we’re running stand-alone…” I removed that, and the corresponding “}” and “else…” codes but then the posts functioned as private posts.

    Since 1.5.1 is supposed to fix some security loopholes I decided to stick with the upgrade, and have uninstalled this plugin.

    Hope you can find a fix soon =)

  61. tatatee
    May 12, 2005 Link to this

    Just found something might be useful to you.
    A list of plugin hooks http://codex.wordpress.org/User:Skippy/Plugin_Hooks

    currentuserinfo is not in the list, might this be the reason why?

  62. tatatee
    May 12, 2005 Link to this

    Just found something might be useful to you.
    A list of plugin hooks http://codex.wordpress.org/User:Skippy/Plugin_Hooks

    currentuserinfo is not in the list, might this be the reason why?

  63. Velmont
    May 12, 2005 Link to this

    I’ve made a few changes to the code (it’s a hack, more or less) to let registered users with *level 0* read post_level=1 posts. This way I can chose to just write something for my registered users, without letting them get writeaccess to the blog.

    I’ve tried to outline how it is done on my blog; http://www.velmont.net/2005/05/12/post-levels/ - I do hope it can be useful for anyone. (it’s nothing advanced, but maybe everyone doesn’t know PHP well enough to hack around themselves) :)

  64. Velmont
    May 12, 2005 Link to this

    I’ve made a few changes to the code (it’s a hack, more or less) to let registered users with *level 0* read post_level=1 posts. This way I can chose to just write something for my registered users, without letting them get writeaccess to the blog.

    I’ve tried to outline how it is done on my blog; http://www.velmont.net/2005/05/12/post-levels/ - I do hope it can be useful for anyone. (it’s nothing advanced, but maybe everyone doesn’t know PHP well enough to hack around themselves) :)

  65. washburn
    May 12, 2005 Link to this

    Ok, I found it, on “Advanced Editing.” Seems ok, but a little awkward. My old WP 1.2 blog had a better implementation with Skippy’s User-Level hack/plugin, which had a nice user-level drop-down menu on the main “Edit” page. This would be a nice addition here, as would be some sort of “Lock” icon. In any case, I’m grateful for your efforts so far on this useful plug-in.

  66. washburn
    May 12, 2005 Link to this

    Ok, I found it, on “Advanced Editing.” Seems ok, but a little awkward. My old WP 1.2 blog had a better implementation with Skippy’s User-Level hack/plugin, which had a nice user-level drop-down menu on the main “Edit” page. This would be a nice addition here, as would be some sort of “Lock” icon. In any case, I’m grateful for your efforts so far on this useful plug-in.

  67. Velmont
    May 13, 2005 Link to this

    Washburn #33: You can easily make a lock-icon yourself! Why’o'why should there be a hardcoded method when you can just utilize your template system instead?

    Just use the example! "; ?>

    Come on, it’s not really that hard now is it? :)

  68. Velmont
    May 13, 2005 Link to this

    Washburn #33: You can easily make a lock-icon yourself! Why’o'why should there be a hardcoded method when you can just utilize your template system instead?

    Just use the example! "; ?>

    Come on, it’s not really that hard now is it? :)

  69. May 14, 2005 Link to this

    All: I’ve updated the Post Level plugin to be compatible with 1.5.1

  70. Kathy
    June 26, 2005 Link to this

    Where does this go?
    This is not working for me.
    The private posts don’t show up even when I’m logged in as a user at the right levels.

    (private)

  71. Kathy
    June 26, 2005 Link to this

    My post didn’t show what I was talking about…

    the is_private() function that is shown above…