Fixing ViewLevel 2.0 in Wordpress 2.6.x
:: Tuesday, April 28th, 2009 @ 3:07:09 pm
:: Tags: Computers
I’ve been using the Wordpress ViewLevel plugin for years, but during a recent Wordpress update, the vl_restricted function (used for inserting a visual notification that a post is restricted) broke. I finally took the time today to fix the problem.
In the file viewlevel2.php, modify the function vl_viewlevel:
Replace:
if(count($values) > 0) {
With:
if($values != '' && count($values) > 0) {
It seems that the Wordpress folk changed the function get_post_meta to return an empty string instead of null when it doesn’t find the meta tag requested. I haven’t confirmed this, but I don’t really care anymore, now that the plugin works again. :)
