Hey all.
I FINALLY GOT MY PLUGIN TO WORK. Apart from one element...
<?php
/*
Plugin Name: Minepress Minecraft Dynmap Plugin
Plugin URI: http://minepress.co.uk
Description: Minepress Minecraft Dynmap Plugin
Author: Bradly spicer
Version: 0.0.1
Author URI: http://minepress.co.uk
*/
/*Installation of Plugin */
/* What to do when the plugin is activated? */
register_activation_hook(__FILE__,'MP_Dynmap_install');
/* What to do when the plugin is deactivated? */
register_deactivation_hook( __FILE__, 'MP_Dynmap_remove' );
function MP_Dynmap_install() {
/* Create a new database field */
add_option("MP_Dynmap_data", 'Testing !! My Plugin is Working Fine.', 'This is my first plugin panel data.', 'yes');
}
function MP_Dynmap_remove() {
/* Delete the database field */
delete_option('MP_Dynmap_data');
}
/*Admin Menu of Plugin*/
add_action('admin_menu', 'MP_Dynmap_admin_menu');
function MP_Dynmap_admin_menu() {
add_options_page('Plugin Admin Options', 'Minepress Dynmap Settings', 'manage_options',
__FILE__, 'MP_Dynmap_options_page');
}
/*Content inside the admin page*/
function MP_Dynmap_options_page()
{
?>
<?php
/* Var */
$port= "2183";
?>
<?php screen_icon(); ?>
<h2>Minepress Dynamic Map Settings</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
Enter IP: <input name="MP_Dynmap_IP_data" type="text" id="MP_Dynmap_IP_data"
value="<?php echo get_option('MP_Dynmap_IP_data'); ?>" /><p>
Enter Width: <input name="MP_Dynmap_Width_data" type="text" id="MP_Dynmap_Width_data"
value="<?php echo get_option('MP_Dynmap_Width_data'); ?>" /><p>
Enter Height: <input name="MP_Dynmap_Height_data" type="text" id="MP_Dynmap_Height_data"
value="<?php echo get_option('MP_Dynmap_Height_data'); ?>" /><p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="MP_Dynmap_IP_data, MP_Dynmap_Height_data, MP_Dynmap_Width_data" />
<input type="submit" value="Save Changes" />
</form>
<?php
$ip = get_option('MP_Dynmap_IP_data');
$width = get_option('MP_Dynmap_Width_data');
$height = get_option('MP_Dynmap_Height_data');
print "Your server details are: ". $ip .":". $port. " the width will be ". $width ." pixels and the height will be " . $height . " pixels";
?>
<?php
/*end of content*/
}
?>
<?php
add_shortcode('MP-Dynmap', 'MP_dynmap_shortcode');
function MP_dynmap_shortcode() {
$width = get_option('MP_Dynmap_Width_data');
$height = get_option('MP_Dynmap_Height_data');
?><html>
<iframe width = "<?php echo $width?>" height ="<?php echo $height?>" id="frame" src="
<?php
$ip = get_option('MP_Dynmap_IP_data');
print $ip . ':8123/';
?>
"></iframe>
</html>
<?php
/*end of shortcode */
}
add_shortcode('MP-Dynmap', 'MP_dynmap_shortcode');
?>
This form will take the width and the height. But not whatever I put in the IP... For me this doesn't make sense at all.
Any help would be much appreciated!