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.

  • Chrissy
    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?
  • Chrissy
    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?
  • Chrissy
    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!
  • Chrissy
    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!
  • Carla
    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. :)
  • Carla
    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. :)
  • 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.
  • 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.
  • Carla
    Ok, I can figure that out but what about their ability to post?
  • Carla
    Ok, I can figure that out but what about their ability to post?
  • 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.
  • 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.
  • giles
    " 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 ;)
  • giles
    " 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 ;)
  • giles
    URL removed by comment author request
  • giles
    URL removed by comment author request
  • WordPress Forums in case some one has done this already.
  • WordPress Forums in case some one has done this already.
  • giles
    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.
  • giles
    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.
  • giles
    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.
  • giles
    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.
  • 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)
  • 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)
  • Shelby
    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.
  • Shelby
    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.
  • Dinh
    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.)
  • Dinh
    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.)
  • Dinh: This is a known issue, and it's currently a limitation in WordPress' plug-in architecture
  • Dinh: This is a known issue, and it's currently a limitation in WordPress' plug-in architecture
  • Anne
    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
  • Anne
    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
  • crash
    hello all

    i've made an enhancer plugin for Post Levels. if anyone is interested, it is here -> http://idlemind.org/journal/projects/post-level...
  • crash
    hello all

    i've made an enhancer plugin for Post Levels. if anyone is interested, it is here -> http://idlemind.org/journal/projects/post-level...
  • Becca
    Thanks for this. :) Just wanted to say that it's working like a charm for me.
  • Becca
    Thanks for this. :) Just wanted to say that it's working like a charm for me.
  • Ludwig
    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
  • Ludwig
    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
  • Ludwig: You should contact the author of the enhancer for your error.
  • Ludwig: You should contact the author of the enhancer for your error.
  • Valerie
    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. :-)
  • Valerie
    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. :-)
  • Secure pages?
    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
  • Secure pages?
    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
  • Shelby
    It wont work with the new wordpress 1.5.1 ... it gives errors. Any idea on when this will work with it? Thanks
  • Shelby
    It wont work with the new wordpress 1.5.1 ... it gives errors. Any idea on when this will work with it? Thanks
  • 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).
  • 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).
  • bishop
    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??
  • bishop
    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??
  • Bishop: Which plugins use that function and still work on 1.5.1?
  • Bishop: Which plugins use that function and still work on 1.5.1?
  • Shelby
    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
  • Shelby
    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
  • crash
    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
  • crash
    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
  • bishop
    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...
  • bishop
    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...
  • tatatee
    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 =)
  • tatatee
    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 =)
  • tatatee
    Just found something might be useful to you.
    A list of plugin hooks http://codex.wordpress.org/User:Skippy/Plugin_H...

    currentuserinfo is not in the list, might this be the reason why?
  • tatatee
    Just found something might be useful to you.
    A list of plugin hooks http://codex.wordpress.org/User:Skippy/Plugin_H...

    currentuserinfo is not in the list, might this be the reason why?
  • Velmont
    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) :)
  • Velmont
    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) :)
  • washburn
    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.
  • washburn
    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.
  • Velmont
    "; ?>

    Come on, it's not really that hard now is it? :)
  • Velmont
    "; ?>

    Come on, it's not really that hard now is it? :)
  • All: I've updated the Post Level plugin to be compatible with 1.5.1
  • Kathy
    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)
  • Kathy
    My post didn't show what I was talking about...

    the is_private() function that is shown above...
blog comments powered by Disqus