'; echo ''; } //places the javascript into the footer of each page add_action( 'wp_footer', 'amw_chat' ); //prints the required css function amw_chat_css() { echo ''; } //create the database used for storing users and messages function amw_chat_install() { global $wpdb; $table_name = $wpdb->prefix . "amw_chat"; $sql = "CREATE TABLE `" . $table_name . "_messages` ( `message_id` int(11) NOT NULL auto_increment, `ID` int(10) NOT NULL, `name` varchar(250) collate latin1_german2_ci NOT NULL, `recipient` int(10) NOT NULL, `message` text collate latin1_german2_ci NOT NULL, `time_stamp` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`message_id`) ) ; CREATE TABLE `" . $table_name . "_online_users` ( `ID` int(11) NOT NULL auto_increment, `IP` varchar(100) collate latin1_german2_ci NOT NULL, `name` varchar(250) collate latin1_german2_ci NOT NULL, `type` tinyint(2) NOT NULL, `last_active` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `connection_status` tinyint(2) NOT NULL default '0', `top` int(4) NOT NULL default '0', `left` int(4) NOT NULL default '0', `click_id` varchar(150) collate latin1_german2_ci default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `IP` (`IP`,`name`) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } //add the css to page header add_action( 'wp_head', 'amw_chat_css' ); register_activation_hook(__FILE__,'amw_chat_install'); ?>