diff --git a/includes/dashboard.php b/includes/dashboard.php new file mode 100644 index 0000000..4756552 --- /dev/null +++ b/includes/dashboard.php @@ -0,0 +1,128 @@ +Deligraph"; + echo "
Deligraph is a tool that helps you to manage your social media.
"; + echo "For more information, please visit www.deligraph.com.
"; +} + + +function myprefix_register_options_page() +{ + add_menu_page( + 'Session Datas', + 'Session Datas', + 'manage_options', + 'session-datas-options', + 'my_options_page_html', + 'dashicons-chart-area' + + ); +} +add_action('admin_menu', 'myprefix_register_options_page'); + +/** + * The "My Options" page html. + */ +function my_options_page_html() +{ + if (!current_user_can('manage_options')) { + return; + } + + if (isset($_GET['settings-updated'])) { + add_settings_error( + 'my_options_mesages', + 'my_options_message', + esc_html__('Settings Saved', 'text_domain'), + 'updated' + ); + } + + settings_errors('my_options_mesages'); + +?> + get_results(" + SELECT user_locale, COUNT(user_locale) as count + FROM $table_name + GROUP BY user_locale +"); + + $users_countries = $wpdb->get_results(" + SELECT user_country, COUNT(user_country) as count + FROM $table_name + GROUP BY user_country +"); + + $notes_repartition = $wpdb->get_results(" + SELECT level_score, COUNT(level_score) as count + FROM $table_name + GROUP BY level_score + "); + + write_log($users_countries); + + $average_level_score = $wpdb->get_var(" + SELECT AVG(level_score) as average + FROM $table_name + "); + + ?> +