prefix . 'author_chat'; $wpdb->query("CREATE TABLE IF NOT EXISTS $author_chat_table ( id BIGINT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY, nickname TINYTEXT NOT NULL, content TEXT NOT NULL, date DATETIME) CHARACTER SET utf8 COLLATE utf8_bin ;"); add_option('author_chat_settings', 30); } // delete author_chat table function pp_author_chat_uninstall() { global $wpdb; $author_chat_table = $wpdb->prefix . 'author_chat'; $wpdb->query( "DROP TABLE IF EXISTS $author_chat_table" ); delete_option('author_chat_settings'); delete_option('author_chat_settings_delete'); } function pp_scripts_admin_chat(){ wp_enqueue_script('chat-script', plugins_url('chat.js', __FILE__ ), array('jquery')); wp_enqueue_style('author-chat-style', plugins_url('author-chat-style.css', __FILE__)); } function pp_author_chat_setup_menu(){ include 'pp-options.php'; add_dashboard_page('Author Chat', 'Author Chat', 'read', 'author-chat', 'pp_author_chat'); add_menu_page('Author Chat Options', 'Author Chat Options', 'administrator', 'acset', 'author_chat_settings', 'dashicons-carrot'); add_action( 'admin_init', 'register_author_chat_settings' ); } function pp_wp_dashboard_author_chat(){ wp_add_dashboard_widget('author-chat-widget', 'Author Chat', 'pp_author_chat'); } function register_author_chat_settings() { register_setting( 'author_chat_settings_group', 'author_chat_settings'); register_setting( 'author_chat_settings_group', 'author_chat_settings_delete'); } function pp_author_chat(){ global $current_user; get_currentuserinfo(); ?>