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
Install
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.
37 Comments
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?
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!
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.
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.
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 ;)
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
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.
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.
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)
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.
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
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
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/
Thanks for this. :) Just wanted to say that it’s working like a charm for me.
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.
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. :-)
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
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).
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?
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
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
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…
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 =)
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?
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) :)
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 #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? :)
All: I’ve updated the Post Level plugin to be compatible with 1.5.1
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)
My post didn’t show what I was talking about…
the is_private() function that is shown above…