I am writing a plugin and keep running into the problem that my menu pages always appear in my dashboard, even when I require capabilities that don’t exist…
So I tried printing out the values of allcaps and decided afterwards to try and be funny by doing this:
echo (current_user_can("play_chopsticks") ? "yes" : "no");
True enough, the result is “yes” !!!
I added this during plugin activation:
$role = get_role( 'administrator' ); $role->add_cap( 'manage_wuss' );
Yet when I do any of these, the menus appear in the dashboard:
add_menu_page("MyHead", "WUSS", manage_wuss, "wuss_settings", show_wuss_config); add_menu_page("MyHead", "WUSS", manage_wussies, "wuss_settings", show_wuss_config); add_menu_page("MyHead", "WUSS", manage_whisky, "wuss_settings", show_wuss_config); add_menu_page("MyHead", "WUSS", shuold_manage, "wuss_settings", show_wuss_config);
Is this normal behaviour for super admin accounts? I am beginning to think something is seriously wrong because I was trying to load my settings page using
include_once('settings.php')and true enough it works just fine on the site dashboard but in the netword dashboard I get an error about calling (I forget the exact function now but) something of WordPress that checks the user’s capabilities but when I rename the file from settings.php to anything else, then it loads just fine in the site dashboard and the network dashboard… but now I am running into this issue where absolutely anything I pass to current_user_can() returns true…
Are these two issue related? Is this normal for Super Admin roles? Is my site totally messed up? Does anyone have any ideas?
- The topic ‘Should super admin have capabilities that don't exist?’ is closed to new replies.