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
New Features
- Use the post teaser as the preview: You can now show the post teaser as the preview for non-logged in users. (requested by Gas)
- Bug fixes: This release should fix the issues with Ultimate Tag Warrior 3.1415926 (duplicate posts and SQL errors). If you find more, please let me know.
Note: Several people have mentioned that Post Levels is causing their posts to appear in reverse order. I’m unable to duplicate this, so please let me know if it’s still happening in this version.
110 Comments
So far, so good. At first glance all my problems have been resolved. Thank you!
Seems to be working fine for me. The posts are appearing in the correct order again. Thanks a bunch.
Thanks for this plugin! Everything’s working well, except there’s one entry in my archives that’s showing up 3 times on the list. I’m using SRG Clean Archives.
Rai: It looks like SRG Clean Archives uses a slightly different SQL query for the archives. If you want to fix this, you can edit the archives plugin as follows.
$arcresults2 = $wpdb->get_results("SELECT ID, post_date, post_title, comment_status ...$arcresults2 = $wpdb->get_results("SELECT DISTINCT ID, post_date, post_title, comment_status ...That should fix your problem.
Weirdly enough, I find that on my test blog, it’s working perfectly EXCEPT for the using a excerpt as a teaser function. I have that option selected, but it’s not showing up when I log out and visit the page.
(http://test.gordsellar.com)
Gordsellar: If you want to use the excerpt as the post teaser, you must make sure to manually enter an excerpt when authoring the post. If you leave that field blank, the default “You have to be logged in” text is shown.
I’ve found a minor issue with this version. Users at a WordPress level of Administrator are able to see all posts, even if those posts belong to another user (even another Administrator user) and those posts have a higher Post Level than their user Post Level.
Example: Administrator #1 has a Post Levels user level of 5. Administrator #2 writes a post assigned Post Level 10. Administrator #1 can see that post.
Is this a bug, or is this by design?
I’m using WordPress 2.1.1 and Post Levels 1.1.1. This behavior did not occur with WP 2.0.x/PL 1.0.
Joefish: By design, although open to debate.
I’ve never tested it, but can the admin see all private posts in the admin area of WP? I don’t touch the SQL in the admin area (too risky).
They are visible under Manage -> Posts (wp-admin/edit.php).
The post total under Users -> Authors and Users (wp-admin/users.php) reveals only public posts. That is, if there are six posts, but only one of them is public the Actions column will list “View 1 post.” However, if you click that link you’re back to Manage -> Posts (ex. wp-admin/edit.php?author=4) where all posts are again visible.
Joefish: Yeah, that’s what I thought. I’d say it’s by design — hiding those posts would require editing the admin SQL queries, which can be risky in my opinion (I would hate to lock somebody out of the admin area through an error).
After further investigation, I’ve found that it’s not Post Levels that’s changed, but rather WordPress. In 2.0.x, a private post would be visible only to the post author (without any plugins, I mean). In 2.1, private posts are always visible to all Editors and Administrators.
How do one make use of the “teaser” feature? And for the title plus excerpt, does it mean that anything I typed on the “excerpt field” at the “create new post page” will be visible to all readers?
And on the post level configuration page, I’m seeing this :
Private Post Title Prefix:
Private Post Title Prefix:
Default Post Level
and so on.
Why is there a duplicate of the private post title prefix?
Thanks!
Oh nevermind, I missed out the prepended and appended. Sorry for the multiple comments.
reallybites: I can’t tell if you figured out your issues. Regardless, the “Title plus excerpt” preview will show the excerpt you type into the “Post Excerpt” box on the “Write Post” page to non-logged in users.
Thanks! How about the “teaser” feature? How does it work?
reallybites: The teaser function will only show the content you place before the
<!--more-->in the post. You can find a description on the WordPress Write Post documentation page.Can we have an example of how to use the teaser? I’m a little confused. I’ve tried the exerts and bit, but it doesn’t work. Does one have to turn it on, or something?
Also, is there a way to indicate if the post is private in the blog, so users who login automatically know what are private posts and what are not?
Sophia: If you go to the Plugin page, you’ll see a menu option to control the Post levels configuration. In there, you can set the Private Post Preview option in order to use the teaser. You can also add text to the title of a private post, using the post title prefix and suffix.
Works ok for me, the list of pages no longer appear three times. Kudos!
One question though… Is there a hack available that allows me to display the recent comments on the sidebar depending on the post level of the reader?
@fil: *cough* Whoops.
I love you. =-) Marry me?
Thanks!
Should have tested before posting.
People can only view the posts if they are logged in. The teaser or any other option does not appear, even when it’s turned on.
And is there any way to make the pre-fix or post-fix an image, instead of text?
See, this is my goal. One day I hope to make plugins so cool they elicit marriage proposals.
Joiz: I don’t know of one offhand, but if you can wait a bit, I was planning on making a widget that supports post levels (it would require you to use the Widgets plugin though).
Sophia: When you turn on the teaser, do non-logged in users see the title of the private post? Or just nothing at all? If they see the title, then make sure you’ve written a teaser / excerpt (you have to do this manually). If they don’t see the title (i.e. nothing is displayed of that post at all), then I don’t really know what’s wrong (perhaps you have caching turned on?).
You can put in HTML into your prefix / postfix for private posts — so use something like
<img src="private.gif" />(whereprivate.gifis the name of the image).@fil: For the record, one should change the double quotes to single quotes if they’re going to add HTML to their prefix or postfix. Otherwise you end up with some funky things in the title.
And yes… WTF is up with this lack of teasing? *sigh* If you’re interested, take a jog over to my website and take a look.
Sophia: Yes, depending on the theme, you can run into issues with HTML inside the pre/post fix. Your other option is to modify your theme to use the
is_private()function to conditionally output during your post loop.As for the lack of teasing. I think I realized why it’s not working for you — I only show the teaser for items that are at or below the default post level (which is 0 by default). Change the default post level to something higher (or post the posts you want teased at level 0) and you should see the teasers. I didn’t really document that feature very well. Or at all.
Apparently the default user level has to be higher as well. Is there any way we could have that changed?
Sophia: I’ll add a new option in the next version that will let you control that. If you want to change it yourself, you can edit the file on line 113, and change
to
Or however high you want posts to show …
Hello, this is great plugin, but when using with Gengo (multilanguage plugin), there is SQL 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 'p ON p2l.post_id = p.ID INNER JOIN wp_categories AS c ON p2c.category_id = c.cat' at line 1]
SELECT c.*, COUNT(*) as category_count FROM wp_post2lang p2l INNER JOIN wp_post2cat p2c ON p2c.post_id = p2l.post_id INNER JOIN (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) p ON p2l.post_id = p.ID INNER JOIN wp_categories AS c ON p2c.category_id = c.cat_ID WHERE p2l.language_id IN (1) AND p2c.category_id IN (1,3) AND p.post_type = ‘post’ AND p. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value
Neoen: Change line 254 of the plugin from:
to
That should fix the issue.
I LOVE the PostLevels plugin but I can’t get the option to work that lets non-registered users see the title of the post they can’t read. When I first installed it, I saw the options on the PostLevelConfigurations menu; sadly, the option listed there now is “none for posts to be completely hidden from people who aren’t logged on”
I am using the latest version of WP and Post Level 1.1.1
Thanks!
Ebenezer — The posts shown in the preview are only those below the default user level — so you need to set the post preview option as well as the default user level.
I’m one of the old complainers about the RSS issue. I was looking into a possible solution when I upgraded my friend to the latest WordPress and went through all the plugins to check for updates. Naturally you’ve been hard at work lately. I’m not sure how you plan on re-implementing the feature but assuming there needs to be some sort of basic authentication I thought I’d point out the page that I planned on using with the old stuff. I got it to function correctly in a web browser, but upgrade before doing a full test…
http://labs.spaceshipnofuture.org/icky/HTTP%20authentication%20with%20PHP-CGI/
Fil,
I am having a similar problem as Ebeneezer – I get the same message he does in the Post Levels Configuration box. I have the latest version of Word Press, and I installed the plug-in and activated it, and typed in a prefix comment, and set the configuration to Teaser. I then logged off the site and went to look at the blog to see if the plug-in worked.
I couldn’t even bring up the webpage. I get a “internet could not display this webpage” message. If I deactivate the plugin, the page works fine. If I try to change user levels, or change the default post level or default user level I get the following message, and if I say yes – nothing changes:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/d/r/d/drdetecto/html/wp-admin/admin-header.php:16) in /home/content/d/r/d/drdetecto/html/wp-includes/functions.php on line 1219
What exactly does this mean and how do i fix it?
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 'posts, wp_post2cat post2cat WHERE posts.ID 21 AND posts. (wp_' at line 2]
SELECT DISTINCT posts.ID, posts.post_title, posts.post_date, posts.comment_count FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) posts, wp_post2cat post2cat WHERE posts.ID 21 AND posts. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value 20060316195321 ORDER BY RAND() LIMIT 5
* No related posts found.
PS. i believe it has something to do with my Category Tagging plugin
Hi Fil,
I am making the switch of my site from WordPress 2.0.7 to 2.1.2, and with 2.0.7 I was using a modified version of Post Levels 1.0. I really can’t remember how I exactly I had the plugin modified, but there is a feature in it that I like. It was an instruction page function, that if some one who didn’t have enough access tried to access the page, it would just show them that page. Was that one of your original functions of the plugin, or something I had added?
[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 'p ON p2c.post_id=p.id WHERE (p. (wp_posts.post_status = 'publish' at line 5]
SELECT p2c.category_id AS cat_id, COUNT(p2c.rel_id) AS numposts, UNIX_TIMESTAMP(max(p.post_date_gmt)) + ’3′ AS last_post_date, UNIX_TIMESTAMP(max(p.post_date_gmt)) AS last_post_date_gmt FROM wp_post2cat p2c INNER JOIN (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) p ON p2c.post_id=p.id WHERE (p. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value
[Unknown column 'p.id' in 'on clause']
SELECT p2c.category_id AS cat_id, COUNT(p2c.rel_id) AS numposts, UNIX_TIMESTAMP(max(wp_posts.post_date_gmt)) + ’3′ AS last_post_date, UNIX_TIMESTAMP(max(wp_posts.post_date_gmt)) AS last_post_date_gmt FROM wp_post2cat p2c INNER JOIN (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) ON p2c.post_id=p.id WHERE ( (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value
http://fortes.com/2007/02/16/post-levels-111/#comment-7369
wpress 2.1, Ultimate Tag Warrior 3.1415926, Post Levels 111
did You mention mysql query bugfix? :)
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 ‘p on p2t.post_id = p.ID WHERE post_date_gmt
Just some feedback about getting categories to list on WP 2.1.2 with Post Levels 1.1.1.
I found didn’t work, but does work.
So as you already document show_count needs to be 1, but it seems changing hierarchical to 0 also breaks the category listing.
Otherwise we’ve found the plugin really great – thanks.
Sorry – my previous message got munged – hopefully this will work:
Just some feedback about getting categories to list on WP 2.1.2 with Post Levels 1.1.1.
I found wp_list_categories arguments ‘title_li=&show_count=1&hierarchical=0′ didn’t work, but ‘title_li=&show_count=1′ does work.
So as you already document show_count needs to be 1, but it seems changing hierarchical to 0 also breaks the category listing.
Otherwise we’ve found the plugin really great – thanks.
This definitely fixed my problem with administrators not being able to see private posts even with a user level of 10. And also fixed the ordering of posts.
You rock! Thank you for this plugin.
This is a bit strange. I’ve created 2 postings; one with postlevel 2 and another with postlevel 5. I’ve also created 2 users, one with userlvl 1 and another with lvl 8.
The postings with postlevel 2 and 5 should be visible to userlvl 8 and userlvl 1 should not be seeing anything. But unfortunately userlvl 1 can see both postings (lvl 2 and 5)
Both users are created as subscribers.
I’m unable to change the post level after I’ve already published. For example, if I post a level 3 and edit it to be a level 4, the post automatically goes back to being a level 3. Any suggestions on how to fix that?
Ahh… I found the reason. Your plugin only works with WP 2.1.1, and I’ve upgraded to 2.1.3
I just downgraded again :-|
@Janus – I’m using Post Levels 1.1.1 with WP 2.1.3 and I’m having no problems.
Joefish -> Weird… but it works perfectly after my downgrade. Well… I think I can live with wp2.1.1 :)
Thanks for the plugin !
However, I get exactly the same error as Janus mentioned 4 messages above (http://fortes.com/2007/02/16/post-levels-111/#comment-9320). I have installed a clean version of WP 2.1.3 with Kubrick default theme, and have tested the plugin exactly the same way as Janus did, and all posts were visible to logged-in users whatever their post level restriction. Only non logged-in users were restricted.
I wonder what changed from WP 2.1.1 to 2.1.3. that blocks the plugin to work properly. Any ideas ? Thanks a lot !
Thank You
Thanks for this plugin, Fil.
I just wanted to flag the same issue that Seb has with WP 2.1.3. Any user, once logged in, can see a private post, irrespective of its level.
(http://fortes.com/2007/02/16/post-levels-111/#comment-9826)
I’ll try to figure out a fix and post back here, but it’d probably be faster if you did it. :)
I’m seeing the everybody-can-read 2.1.3 behavior. if you get a fix for this I’d love to know about it. thank goodness, though… I thought it was just me! :)
Hi, I’m getting this error as well with WP 2.1.3:
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 'ORDER BY post_date ASC LIMIT 1' at line 1]
SELECT ID, post_title FROM wp_posts WHERE post_date > ” AND post_type = ‘post’ AND post_status = ‘publish’ AND ID != ORDER BY post_date ASC LIMIT 1
When using Event Calendar plugin I get
WordPress database error: [Column 'post_id' in where clause is ambiguous]
SELECT DISTINCT id, post_title, GREATEST(start,’2007-05-01 00:00:00′) AS start_date, LEAST(end,’2007-06-01 00:00:00′) AS end_date, allday, 1 AS is_event FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)),wp_ec3_schedule WHERE (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value =’2007-05-01 00:00:00′ AND start=’2007-05-08 00:00:00′ ORDER BY start LIMIT 3
Thank you for any help and for this plugin.
Hi! Thanks a lot for your great plugin! However, when turned on, I’m getting a MYSQL error when combined with the extract terms plugin by Semiologic, more specifically, the related entries plugin. Here’s the 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 'as posts LEFT JOIN wp_postmeta as postmeta ON postmeta.post_id = posts.' at line 6]
SELECT DISTINCT posts.*, MATCH ( posts.post_title, posts.post_content ) AGAINST ( ‘background vocals underground rock scene dregs belts have never heard awesomeness reminiscent medium pace drastic change japanese underground acoustic sound shigure fresh sound mood changes time changes miyamoto instrumentals 3 piece passionately rin’ ) AS mysql_score FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) as posts LEFT JOIN wp_postmeta as postmeta ON postmeta.post_id = posts.ID WHERE posts.post_date_gmt 55 AND ( posts.post_password = ” ) AND ( (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value
On activation, plugin completely destroys my theme layout and goodness knows what else…
Warning: Cannot modify header information – headers already sent by (output started at C:\Inetpub\vhosts\st-andrews-fund.org.uk\httpdocs\wp-content\plugins\post-levels.php:688) in C:\Inetpub\vhosts\st-andrews-fund.org.uk\httpdocs\wp-includes\pluggable.php on line 271
OK. I am using 2.1.3 and I had hoped to use it in 2.2… I now understand it does not work in these versions. Are you going to update the plug-in?
Mea culpa. After spending a weekend analysing the code and SQL, on WP 2.1.3 Postlevels works just fine for me.
I didn’t realise that WP displays private posts irrespective of the level if the post was authored by the user who is currently logged in. Once this is taken into account during testing, the behaviour seems correct.
Everything seems to be working well now.
I have now tried Post Levels 1.1.1 on my WordPress 2.2 blog and it may well work but I do not know because it throws so many errors and completely destroys my theme in the process!
A great shame because the plugin sounds just what I need!
Hey there, first of all, thanks muchly for this plugin, I’ve been using it for ages now.
I did upgrade to 2.1.3 recently however and I am experiencing the same problems that Jin and Seb mentioned. Users that are not logged in do not see the private posts. Users that are logged in can see every post, whether their userlevel is lower than the post or not. None of the posts are authored by them btw.
I really really like this plugin. It is a great solution for personal bloggers. I’m wondering: Is there a simple way to reduce the number of privacy levels from 10 to 3? And if so, would there be a friendly way of being able to rename to things like “Family” “Friends” “Public”, etc.?
Delightful plugin. Some sort of widget or hook for a widget that only displays based on the user level would be great. Even if it was just like the “text” widget, but with user level control… or even some php code we could paste in a text widget to restrict access to that widget. Anything along those lines would be excellent. Thanks!
hi all.
Any progress on getting this to work for WordPress 2.2?
Hello. I think this plug-in is what I need, and I thought I set it up correctly; but it’s not working out as expected. Here’s what I want to do:
I have a private level 3 post.
I want non-logged-in users to see the title + excerpt.
I want logged-in level 0 to level 2 users to see the title + excerpt.
I want logged-in level 3 and above users to see the full post (but know it was private via the prefix/postfix title text).
However, what I get is is that non-logged-in users and logged-in users below level 3 don’t see anything about the post. So I think I’m configuring something incorrectly. This is on a fresh WP 2.1.1 install and is the only plug-in activated. Please help me configure this if possible. Thanks!
Do you have any ideas on when the http_auth querystring capability will be available again? This functionality would make my company’s blog a lot more convenient for our employees – I’d even be willing to help if you would provide me some points. Thanks so much for this great plugin!
I can’t get this plug in working on WP 2.2. It does not matter what levels I set to the post or to my user, the post always shows. If I understand it correctly it might not be working for WP 2.2?
Is there anyway to rename, or add descriptive text to, the level numbers in the select box on the new-post page? It would be nice to have the same descriptions as are used for users in the user management interface.
Great plugin by the way, thank you very much for writing it!
Hi, I have the same as Cristian already mentioned, with ventcalendar plugin there is the following problem:
WordPress database error: [Column ‘post_id’ in where clause is ambiguous]
SELECT DISTINCT id, post_title, GREATEST(start,’2007-05-01 00:00:00′) AS start_date, LEAST(end,’2007-06-01 00:00:00′) AS end_date, allday, 1 AS is_event FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)),wp_ec3_schedule WHERE (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value =’2007-05-01 00:00:00′ AND start=’2007-05-08 00:00:00′ ORDER BY start LIMIT 3
What can I do to fix this?
TIA peter “un loco”
hi, I fixed the problem with EVENTCALENDAR PLUGIN.
could not sent the code via your message form. please give me your email-adress.
mine is: tanguero at un-loco dot de
best regards
peter stiens from germany
On line 567 there is an extra ‘) between the php tag and the end of the option tag that causes an error metioned in some of these comments. In the admin section it causes the option for Title, Title/Excerpt, Teaser, None to become “None for posts to be completely…” Removing that ‘) fixed the problem. I was using v. 1.1.1. The bug showed up in IE7, but the code itself is invalid on that line.
Great plugin! It works great!
I have installed Post Levels 1.1.1 on WordPress 2.2.2, and it’s working well except for comment feeds. (Private posts were also showing in post feeds, although I think that’s probably a WordPress bug.)
In my comment feeds, the last comment is duplicated for however many comments are in the feed. This does not happen if I disable the Post Levels plugin.
I checked over the plugins I have enabled, and I think the only one that might be related to comment feeds is Akismet, but the problem still occurs if I disable Akismet. (I also tried deactivating Get Recent Comments and Smart Comment Link, but that made no difference either.)
Is anyone else experiencing a similar problem?
I am using WP 2.3B2 (I am preparing a site for release in a couple of months, so I’m ensuring I work with WP 2.3).
I get the same MySQL error everyone else is getting:
”
WordPress database error: [Column 'post_id' in where clause is ambiguous]
SELECT DISTINCT id, post_title, GREATEST(start,’2007-09-01 00:00:00′) AS start_date, LEAST(end,’2007-10-01 00:00:00′) AS end_date, allday, 1 AS is_event FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)),wp_ec3_schedule WHERE (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value =’2007-09-01 00:00:00′ AND start
Holy cow. I have no idea what it did, but it completely blew up my DB.
First of all, it wouldn’t let me deactivate it. I had to physically remove the plugin, and the errors keep coming. Good thing I was working on a sandbox.
I have two plugins that may be contributors: wp-cache and eventcalendar 3.
Just FYI. It ws a cached page in wp-cache. I flushed the toilet, and the errors stopped. That doesn’t change the fact that the plugin would not let me deactivate it, though.
I’m using WP 2.2.1 and the teasers aren’t showing up for unregistered users!
I have the plugin actiavted and when I click on a post that is private while not logged in I get a 404 error. Any fix for this?
Thanks
Kevin
Okay, it’s a problem with EventCalendar 3, and it’s a big problem. When you do your SQL parsing, you create LEFT JOINs within LEFT JOINs, and MySQL just goes kablooey.
I think that a substantial part of the blame may lie in the EventCalendar 3 plugin, but it would probably be a good idea for you to see if there’s something that you could do in your code to fix it. Basically, EC3 is doing the same thing that you are, and you guys are colliding. If this happens with EC3, it will probably happen with other plugins as well.
I’ll let the EC3 person know about this as well, so they can address their own issues.
The SQL query needs the tables adding.
Here’s a quick and dirty hack that made this work for me on WP2.3. I put my changes into postlevels_query_cleanup – mainly so I could track it and rip it out later. (Nice code btw – this ‘cover the exceptions’ function really comes in useful)
post-levels.php
insert at line 246:
// fix for WordPress 2.3
// evilzenscientist – 2 Oct 07
$sql = preg_replace(“/post_id/”, “wp_postmeta.post_id”, $sql);
$sql = preg_replace(“/, meta_value/”, “, wp_postmeta.meta_value”, $sql);
$sql = preg_replace(“/meta_key/”, “wp_postmeta.meta_key”, $sql);
// end
Urg – the comments system ate this.
I posted what works for me at: http://www.evilzenscientist.com/blog/2007/10/02/post-levels-update-for-wordpress-23/
i get the following errors with post levels 1.1:
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 'p WHERE p.post_date '2007-10-10 20:25:45' AND p.post_type = 'post' AND p. (wp' at line 1]
SELECT p.ID, p.post_title FROM (wp_posts LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id) AS p WHERE p.post_date > ’2007-10-10 20:25:45′ AND p.post_type = ‘post’ AND p. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (wp_postmeta.meta_key = ‘post_level’ AND wp_postmeta.meta_value
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 'p WHERE p.post_date '2007-10-10 20:25:45' AND p.post_type = 'post' AND p. (wp' at line 1]
SELECT p.ID, p.post_title FROM (wp_posts LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id) AS p WHERE p.post_date > ’2007-10-10 20:25:45′ AND p.post_type = ‘post’ AND p. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (wp_postmeta.meta_key = ‘post_level’ AND wp_postmeta.meta_value
Hi,
First of all, let me thank you for a wonderful plugin that has been in my blog since it started. It is easy to use and serve exactly the purpose of what I have in mind.
With WP2.3, I am a little stuck cos it does not seem to work with this new version of wordpress (at least not yet) and I would like to try some of the new stuff in 2.3.
Any thoughts of updating this plugin for WP 2.3?
Thanks again for the good stuff…
KA
Why the plugin’s author is not helping us anymore ?? i’ve got this 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 ‘p WHERE p.post_date
Erreur de la base de données de WordPress : [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 ‘p WHERE p.post_date
Can the content of my posts to be read and indexed by search engine but protected from human eyes when they click through?
Can the protected posts still be listed with the archives, latest posts, and random posts plugin?
Does the post level plugin work with pages as well?
This plugin works fine for me after following Doug Neiner’s solution (see previous comment @ 16 aug 2007). Just remove the ‘) from line 567…
I am using WordPress 2.3 and post-levels v1.1.1.
Thanks Fortes!
I’m with Naz, above. With my default post level and default user levels both set to 0, I would hope that there would be some way to show teasers to non-logged-in users, but no. Posts with a post level of 1 are invisible to everyone except users with at least a post level of 1.
If there’s no way to show a teaser to anyone, I’m not sure I see the point.
Cool.
Can someone post an edited version of the plugin?
Thanks,
David
Can you post the working version for WP 2.3.1?
This seems to be a nice plugin. Though making pages private lets them appear as non existant. Clicking a page link just gives a 404 error.
No matter to what I set the preview option, non logged in users simply get the error. Instead it should post a page preview I think. Not?!
I installed the latest version of wordpress and upgraded to Post Levels 1.1.1 the other day. All appeared to be working fine. Today, though I noticed that any person that has access to any level of private post suddenly has access to ALL levels of private posts. Anyone else have this happen?
I am running WP 2.3.1 with Post Levels 1.1.1. I have PostLevels set to display the title-only of my private entries in feed readers.
However, this doesn’t work for any entry published at levels above 0. I use level 2 for my private entries, and I want these to display a title on feed readers.
Is there a fix for this??
Hello, I love this plugin and am using Post Levels 1.1.1. Ever since I upgraded to WordPress 2.3.1, I noticed that there’s a WordPress database error. It only shows up if I’m logged in as an Admin. But the unlogged view (as seen by guests) won’t show any errors as I mentioned. I found this really strange. Is there a remedy for this when I log into my admin panel so I won’t see these errors. I really appreciate your time for making this plugin.
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 'AS p WHERE p.post_date
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 'AS p WHERE p.post_date > '2007-12-15 23:33:51' AND p.post_type = 'post' AND p. ' at line 1]SELECT p.ID, p.post_title FROM (b2posts LEFT JOIN b2postmeta as pl_b2postmeta ON (b2posts.ID = pl_b2postmeta.post_id)) AS p WHERE p.post_date > '2007-12-15 23:33:51' AND p.post_type = 'post' AND p. (b2posts.post_status = 'publish' OR (b2posts.post_status = 'private' AND (pl_b2postmeta.meta_key = 'post_level' AND pl_b2postmeta.meta_value
I am getting the same error as AG. The previous version I had, v1.0, does not have this error. So something that changed between 1.0 and 1.1.1 is causing that error to happen. If that is of any help
Still having the same issue as above but here’s more detail :
wp v2.3.2 + pl v1.1.1
* users level 0 can not see any private posts, as would be expected
* users level 1 can see level 1 private posts but no private posts above level 1, as would be expected.
* users level 2 and up can see all private posts regardless of level
Is this the general incompatibility with wp 2.3x that I keep reading about … or is there a fix? I’ve combed through the plugin code but I can’t find anything that does anything different between a level 1and a level 2 user.
I have the same problem like Carrie. (WP 2.3.3 and PL 1.1.1).
It seems that PL works fine for people are not logged in (you cannot see private posts). But people logged in of all levels (0,1,2,3,…) can see Level 10 postings (or any other higher level posts) at any time.
Aktivated Plugins Running (AddQuicktag, Aksimet, AddQuicktag, Lightbox JS v2.03.2 Plugin, Post Levels, The Hacker’s Diet)
Thank you for your wonderful coding! But I’ve found one little glitch…. I’m running WordPress 2.3.2 with the plug-in ‘page-links-to’ version 1.4 and your plug-in version 1.1.1.
My issue is that when I’m logged in, my links that use the ‘page-links-to’ plug-in don’t open in a new window like I’ve told them to, but when I log out they do open in a new window…. Any thoughts? Not a big deal, just curious.
Does it work with 2.3.2? Looks like mixed results.
If not, when do you anticipate upgrading for 2.3.2?
Also, want to run with rolemanager 2.2.1 – any known problems?
Thanks!
I’m using WP2.3.3 + PL1.1.1. The levels are working as expected, but the Recent Posts and Pages menu are showing all posts as (Private). Actual blog titles are correct. When I view a non-private post, the postfix on the menu disappears.
I wonder if others face the same problem or its something to do with my theme/setup.
FYI, a little debug shows that in postlevels_the_title() $incomingpost always references my last post or whatever post i’m viewing. not sure if this info helps.
I just downloaded your Post Level plugin. I think this is going to be great and allow me to accomplish what I am looking for in regards to privacy on certain posts.
I did notice one thing that doesn’t seem to be working? Or maybe it is just my template? If I login as a user with a post level of 1, I can do a search on the blog and view all private posts, even those that should only be viewable for those that have a level of 10. (These posts are not viewable for users NOT logged in, so only registered users can view.)
Is there something I need to do/update so that they cannot be searched on by users with lower post level permissions? There are just certain things I do not want my mother-in-law to stumble upon, if you know what I mean. :-)
I am using WordPress 2.2 and have tried this one two different themes with the same result.
Thanks so much for sharing this great plugin. I look forward to applying it to more posts.
The private posts not showing up in categories problem is normal for wordpress, not related to theme but to whether there is a public post in the category. Even without this plugin, if you save a post as private and click on “manage” > “categories”, the count of posts won’t be updated.
One way to fix this is to make one empty public post per category so the category is visible.
Another way is to edit wp-includes/taxonomy.php
In the function _update_post_term_count, change the bit that says “post_status = ‘publish’”
to “(post_status = ‘publish’ or post_status = ‘private’)”
Like…
$count = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND (post_status = ‘publish’ or post_status = ‘private’) AND post_type = ‘post’ AND term_taxonomy_id = ‘$term’”);
…then re save all your private posts(or one post per category) so that the category count is bigger than 0
Is there a way to display the level of the post, in the heading for example? Actually, I want to display the headings in different colors, so people know which posts are the most private etc.
I tried is_post_level(1) and the $post_level variables, but to no success.
Ah, got it. To access the level-number inside the loop, use:
$thispostlevel = get_post_custom_values(get_option(‘postlevels_post_key’));
Ah, got it. To access the level-number inside the loop, use:
$thispostlevel = get_post_custom_values(get_option(‘postlevels_post_key’));
this returns an array, the post level is $thispostlevel[0].
Hi! I’m using your plugin to restrict the access to some pages for some user. Is it possible to show a standard text like “You do not have enough rights to show this page” if users try to open such a page?
You can have a look at my Website. I’d like to have such a message on the “VIP” Page, if unregistered users or users without enoug rights open this page.
With kind regards from Germany!
Krooms
hi fil…
first of all thank u for this plugin..it works perfectly with my post, but not with my pages..
if i set private a page (lev 2 for example) when i click on publish it is saved as draft and the button it’s is invisible to all. how can i resolve it? Thank you
I have a fresh 2.3.3 wordpress and this plugin is activated but it’s not working well.
I have 2 posts with level 1 and 2.
I have 2 users with level 1 and 2.
If there is no one logged in they can’t see the posts with level 1 and 2.
But, if user1 is logged, he can see both posts. Same issue with user2.
Thank you.
6 Trackbacks/Pingbacks
Post Levels 1.0.9 (for WordPress 2.0.x)…
I’ve gotten a few emails from people that are still running the 2.0.x versions of WordPress (which will apparently be supported until 2010). Due to a boring technical reason, the “User Levels” menu is hidden from the admin section if …
[...] Just wanted to give a friendly reminder to all the WordPress people that Post Levels is out and works with WordPress 2.1.x … You can check it out here. [...]
[...] Visit [...]
[...] made an update for the post-levels plugin so it works with WordPress [...]
[...] the end I used the post-levels plugin from Filipe Fortes - it needed some SQL mungling to work with WordPress 2.3 – but the end [...]
[...] added a couple plugins to WordPress today. I added Post Levels so I could add a private section to the blog. Now, if the title of the post has “- [...]