Plugin rename
This commit is contained in:
@@ -3,27 +3,27 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function mystat_dashboard_page() {
|
||||
echo '<div class="wrap"><h1>Moje Statystyki Sportowe</h1>';
|
||||
mystat_render_history_table();
|
||||
function statpress_dashboard_page() {
|
||||
echo '<div class="wrap"><h1>StatPress Dashboard</h1>';
|
||||
statpress_render_history_table();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function mystat_render_history_table() {
|
||||
function statpress_render_history_table() {
|
||||
global $wpdb;
|
||||
|
||||
// Definicje nazw tabel (z uwzględnieniem prefixu WP, jeśli był użyty przy tworzeniu)
|
||||
// Zakładam, że tabele nazywają się dokładnie tak jak w dokumentacji, ale dobrą praktyką jest $wpdb->prefix
|
||||
// Jeśli tabele są "sztywne" (bez prefixu wp_), usuń $wpdb->prefix.
|
||||
$table_activities = $wpdb->prefix . 'mystat_activities';
|
||||
$table_categories = $wpdb->prefix . 'mystat_categories';
|
||||
$table_activities = $wpdb->prefix . 'statpress_activities';
|
||||
$table_categories = $wpdb->prefix . 'statpress_categories';
|
||||
|
||||
// --- 1. OBSŁUGA USUWANIA (DELETE) ---
|
||||
if ( isset( $_GET['action'], $_GET['id'], $_GET['_wpnonce'] ) && 'mystat_delete' === $_GET['action'] ) {
|
||||
if ( isset( $_GET['action'], $_GET['id'], $_GET['_wpnonce'] ) && 'statpress_delete' === $_GET['action'] ) {
|
||||
$activity_id = intval( $_GET['id'] );
|
||||
|
||||
// Weryfikacja bezpieczeństwa (Nonce)
|
||||
if ( wp_verify_nonce( $_GET['_wpnonce'], 'mystat_delete_' . $activity_id ) ) {
|
||||
if ( wp_verify_nonce( $_GET['_wpnonce'], 'statpress_delete_' . $activity_id ) ) {
|
||||
$result = $wpdb->delete(
|
||||
$table_activities,
|
||||
array( 'id' => $activity_id ),
|
||||
@@ -56,8 +56,8 @@ function mystat_render_history_table() {
|
||||
SELECT a.*, c.name as category_name, c.icon, c.color, et.name as event_type_name, eq.name as equipment_name
|
||||
FROM $table_activities a
|
||||
LEFT JOIN $table_categories c ON a.category_id = c.id
|
||||
LEFT JOIN {$wpdb->prefix}mystat_event_types et ON a.event_type_id = et.id
|
||||
LEFT JOIN {$wpdb->prefix}mystat_equipment eq ON a.equipment_id = eq.id
|
||||
LEFT JOIN {$wpdb->prefix}statpress_event_types et ON a.event_type_id = et.id
|
||||
LEFT JOIN {$wpdb->prefix}statpress_equipment eq ON a.equipment_id = eq.id
|
||||
ORDER BY a.date DESC, a.id DESC
|
||||
LIMIT %d OFFSET %d
|
||||
",
|
||||
@@ -115,16 +115,16 @@ function mystat_render_history_table() {
|
||||
$delete_url = wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'mystat_delete',
|
||||
'action' => 'statpress_delete',
|
||||
'id' => $row->id,
|
||||
)
|
||||
),
|
||||
'mystat_delete_' . $row->id
|
||||
'statpress_delete_' . $row->id
|
||||
);
|
||||
|
||||
$edit_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'mystat-edit-activity',
|
||||
'page' => 'statpress-edit-activity',
|
||||
'id' => $row->id,
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
@@ -132,7 +132,7 @@ function mystat_render_history_table() {
|
||||
|
||||
$details_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'mystat-view-activity',
|
||||
'page' => 'statpress-view-activity',
|
||||
'id' => $row->id,
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
|
||||
Reference in New Issue
Block a user