[Plugin: Level2Categories 2] Working in WP 2.8.6
-
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"); $cat_total=mysql_num_rows($query); 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; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Level2Categories 2] Working in WP 2.8.6’ is closed to new replies.