Support » Plugins » ViewLevel plugin

  • I’ve made a plugin that lets you restrict the visibility of posts by userlevel (I guess I had the same idea as Skippy!) Check it out here:
    (Mine is easier to install – it’s just a plugin – but it looks like his is a better implementation overall, less of a hack…)

Viewing 15 replies - 1 through 15 (of 64 total)
  • skippy



    Nice, wyzewoman! A variety of options can only benefit WordPress: your plugin will appeal to many people that my modification might be intimidated by. The only advantage (in my opinion) that my solution has is that it does not even pull restricted posts from the database, so server load should be a little lighter on popular blogs with (many?) hidden posts. I was always encouraged to structure operations such that the database does all the “heavy lifting”, and your code pulls only the data it needs and is going to use. As such, my modification may be a better solution for people concerned about server load. Your solution looks great, though, and should work fine for most folks.
    Good work!

    I am having some problem with this hack. I keep getting an error
    Warning: Cannot modify header information – headers already sent by (output started at /home/tekwh0re/public_html/wp/wp-content/plugins/viewlevel.php:62) in /home/tekwh0re/public_html/wp/wp-admin/users.php on line 132
    Help, please?

    Can either of these two solutions be used on a whole category? – i.e. I’d like to:
    * show posts from all categories except the restricted ones on the main page
    * in the category list, I’d like all cats to appear, but the restricted ones would be marked (members only) and would lead to the login page unless one was already logged in




    These solutions currently only deal with posts, not categories. You might be able to take either of our private post solutions and apply the method to categories, instead.

    Wyzewoman, I got it to work! I think I may have had a typ0 in there.
    Now if only we could make this apply to a certian category only, it would rock the bestest!
    Thanks for the plugin! =)

    I would be fairly simple to modify my code to make it work for a certain category – you’d just need to change the function filter_posts(); that function checks a post’s viewlevel and compares it to the user level, and you could change it to check the post’s category and, if it was in the right category, compare the user level to the set cutoff. You’d end up changing the line if ($user_level>=$vl){ to whatever your new condition is.

    Ahh. I’ve been looking for something like this for the longest time. From the looks of it, it should be rather painless to implement. The only thing holding me back from actually using it is that the comments are still displayed in the RSS feed. I hope you’re able to fix that. In the meantime, I’ll take a look at Skippy’s plugin (yes, I do have to admit it does look much more intimidating for a somewhat computer-illiterate person like myself).




    If you consider yourself “computer-illiterate”, you’re likely not to be adding (m)any other modifications to the WordPress source code. As such, you could simply copy the modified versions of the core WP files I include with the download into their respective locations, then run the wp-admin/post_level_install.php script. That’s arguably even easier than installing and activating wyzewoman’s plugin.

    =( I’ll look into it but I am not a coder. I can follow instructions but I don’t know how to code. (I’m a network type computer geek so the codies are gods to me.
    I’ll give it a gander however.
    I am still in the process of trying to now find a 3 coloum layout I can modify. Soon, I hope I can go live with the new WP install.

    OK, here’s a quick hack:
    Put the following paragraph into your viewlevel.php file, right before the add_filter lines:
    function filter_cats($cat,$minuserlevel){
    global $posts, $post_meta_cache,$user_level,$category_cache;
    global $post;
    if ($user_level<$minuserlevel){
    if (is_array($posts)){
    foreach ($posts as $post){
    foreach($thecats as $thiscat) {

    Then, at the end of your wp-blog-header.php file, right next to where you have “filter_posts()”, type “filter_cats(‘PrivateCategoryName’,UserLevel);”, where PrivateCategoryName and UserLevel are the names of the category you want private and the minimum user level. This should hide the private category postings from people who shouldn’t be able to see them.

    Ugh… I must be doing something wrong. Now I am getting errors again.
    Though- I did notice something wierd. When I creat a post, none of the categories that I have the option to to put them in are showing up. Everything is going to general even though I have made other categories.

    Hmmm… I don’t have any problems writing posts. What sort of errors are you getting?

    I can make post just fine… but I don’t get any options for what category the post should be in, even though I made a bunch of them.
    For example, I have general, hidden, politics…
    I go to make a post but I don’t get the options for general, hidden, politics, everything just defaults to general.

    Great Plugin!!!! 😉 Thanks a lot

    Just one bug: the hidden posts show up in the calendar’s day-hover text. Great work though!

Viewing 15 replies - 1 through 15 (of 64 total)
  • The topic ‘ViewLevel plugin’ is closed to new replies.