I'm in the process of creating a plugin for 3 blogs running on a single install of WPMU, but the plugin's submenus need to be different for each one.
Each site has it's own unique table (wp_1_ksettings, wp_2_kpsettings, wp_3_kpsettings) with columns that contain the strings needed for the options, identifier, and etc used in this line:
add_submenu_page(__FILE__, $row['option_name'], $row['option_name'], $row['capability'], $row['identifier'], $row['identifier']);
I'm wondering if it's possible to use mysql_fetch_array to generate these submenu pages based on that data in the database using this code.
//Add a menu to the top level
add_action('admin_menu', 'Add_kp_plugin');
//Add a main menu for the plugin
function Add_kp_plugin() {
if (function_exists('add_menu_page')){
add_menu_page('KP Settings', 'KP Settings', 2, __FILE__, 'startup');
global $wpdb;
$result = mysql_query("SELECT * FROM wp_" $wpdb->$siteid . "_kpsettings");
while($row = mysql_fetch_array($result))
{
add_submenu_page(__FILE__, $row['option_name'], $row['option_name'], $row['capability'], $row['identifier'], $row['identifier']);
}
}
}
I'm sure there's another way to do this but I just can't think of it. If anyone out there has any ideas or other suggestions it would be greatly appreciated.