[Plugin: Level2Categories 2] Working in WP 2.8.6 (2 posts)

  1. vtxyzzy
    Posted 6 years ago #

    I have Level2Categories 2 working in 2.8.6. Here are the changes I made.

    In function l2c_admin, change 'add_management_page' to 'add_opeions_page':

    function l2c_admin() {
       if (function_exists('add_options_page')) {
          add_options_page('Levels2Categories Options', 'Levels2Categories', 8, basename(__FILE__), 'levels2categories_admin_page');

    In function l2c_disable_cats, insert line '$user_level = l2c_user_level()':

    function l2c_disable_cats(){
       global $l2c_table, $user_level;
       $query=mysql_query("SELECT * FROM $l2c_table");
       if ($cat_total > 0) {
          $user_level = l2c_user_level();
          echo "<script>";
          while ($fetch=mysql_fetch_array($query)) {
             if ($user_level < $fetch['level']){
                echo "document.getElementById('category-".$fetch['cat_ID']."').style.display='none';";
                echo "if(document.getElementById('popular-category-".$fetch['cat_ID']."')) document.getElementById('popular-category-".$fetch['cat_ID']."').style.display='none';";
          echo "</script>";

    Add new function l2c_user_level:

    function l2c_user_level () {
       for ( $i=10; $i>0; --$i) {
          if (current_user_can('level_' . $i)) return $i;
       return 0;
  2. andreasmacke
    Posted 6 years ago #

    Interesting - I applied this fix to my install (WP 2.9.2), and it rectified a rather strange issue. The plug-in had been working as designed, but then stopped doing so; the only variable (other than demonstrating to a customer, which always brings out the worst in any system) was that I had experimented with some other (unrelated) plugins in the meantime (but had de-activated and deleted all of them).

    Thanks for contributing the fix!

Topic Closed

This topic has been closed to new replies.

About this Topic