This plug-in issues a few PHP notice messages, which are annoying when using DEBUG mode.
Here is a patch against current (1.7) version. The capabilities change is done because user levels is deprecated since a long time now, and issues a deprecation warning. I picked manage_option capability to show the admin menus, but maybe another capability is more appropriate.
Author: Leandro Lucarella <llucax@gmail.com>
Date: Sat Aug 27 21:57:07 2011 -0300
Top-10: Fix PHP notice errors
User levels are deprecated since a long time, we now use the 'manage_options' capability to enable
the admin menus.
diff --git a/wp-content/plugins/top-10/admin.inc.php b/wp-content/plugins/top-10/admin.inc.php
index 1e9cfbd..7926dfc 100644
--- a/wp-content/plugins/top-10/admin.inc.php
+++ b/wp-content/plugins/top-10/admin.inc.php
@@ -3,7 +3,6 @@
* Admin Page *
*********************************************************************/
if (!defined('ABSPATH')) die("Aren't you supposed to come here via WP-Admin?");
-define('ALD_TPTN_DIR', dirname(__FILE__));
if (!defined('TPTN_LOCAL_NAME')) define('TPTN_LOCAL_NAME', 'tptn');
function tptn_options() {
@@ -348,6 +347,7 @@ function tptn_manage() {
/* Add menu item in WP-Admin */
function tptn_adminmenu() {
+ $tptn_is_admin = false;
if (function_exists('current_user_can')) {
// In WordPress 2.x
if (current_user_can('manage_options')) {
@@ -362,9 +362,9 @@ function tptn_adminmenu() {
}
if ((function_exists('add_options_page'))&&($tptn_is_admin)) {
- $plugin_page = add_options_page(__("Top 10", TPTN_LOCAL_NAME), __("Top 10", TPTN_LOCAL_NAME), 9, 'tptn_options', 'tptn_options');
+ $plugin_page = add_options_page(__("Top 10", TPTN_LOCAL_NAME), __("Top 10", TPTN_LOCAL_NAME), 'manage_options', 'tptn_options', 'tptn_options');
add_action( 'admin_head-'. $plugin_page, 'tptn_adminhead' );
- add_posts_page(__("Popular Posts", TPTN_LOCAL_NAME), __("Top 10", TPTN_LOCAL_NAME), 9, 'tptn_manage', 'tptn_manage');
+ add_posts_page(__("Popular Posts", TPTN_LOCAL_NAME), __("Top 10", TPTN_LOCAL_NAME), 'manage_options', 'tptn_manage', 'tptn_manage');
}
}
add_action('admin_menu', 'tptn_adminmenu');