Podam ci 3 kody mojej wtyczki wordpress dla strony internetowej jest to wtyczka…
- User
Podam ci 3 kody mojej wtyczki wordpress dla strony internetowej jest to wtyczka zarządzająca profilami użytkowników chcę abyś sprawdził czy są w kodzie problemy które nie pozwalają na przesunięcie przycisku w wersji mobilnej ponieważ na telefonie jest on ucięty w połowie i nie mogę go przesunąć :
PHP :
<div class="popup-content" style="background-color: #b49480;"> <!-- Zmiana koloru tła popupu --> <button class="close-popup" id="close-popup">X</button> <h2>Profil użytkownika</h2> <div class="tabs"> <button class="tab-button active" onclick="showTab('profile')">Profil</button> <button class="tab-button" onclick="showTab('settings')">Ustawienia</button> </div> <div id="profile" class="tab-content active"> <form method="post" enctype="multipart/form-data" class="profile-form" id="profile-form"> <?php wp_nonce_field('upp_save_profile_action', 'upp_save_profile_nonce'); ?> <fieldset> <legend>Zdjęcie profilowe</legend> <img id="avatar-preview" src="<?php echo esc_url(get_user_meta($current_user->ID, 'avatar', true)); ?>" style="max-width: 250px; display: <?php echo get_user_meta($current_user->ID, 'avatar', true) ? 'block' : 'none'; ?>;" class="avatar-preview"> <label for="avatar">Wybierz zdjęcie (max 5 MB):</label> <input type="file" name="avatar" accept=".png,.jpg,.gif" required /> </fieldset> <fieldset> <legend>Twoje dane</legend> <label>Imię i nazwisko: <input type="text" name="full_name" value="<?php echo esc_attr(get_user_meta($current_user->ID, 'first_name', true) . ' ' . get_user_meta($current_user->ID, 'last_name', true)); ?>" required></label> <label>ID użytkownika: <input type="text" value="<?php echo esc_attr($current_user->ID); ?>" readonly></label> <label>ID z M2M: <input type="text" name="m2m_id" value="<?php echo esc_attr(get_user_meta($current_user->ID, 'm2m_id', true)); ?>" required></label> <label>ID dystrybutora M2M: <input type="text" name="distributor_id" value="<?php echo esc_attr(get_user_meta($current_user->ID, 'distributor_id', true)); ?>"></label> <label>Link do profilu na FB: <input type="url" name="fb_link" value="<?php echo esc_attr(get_user_meta($current_user->ID, 'fb_link', true)); ?>"></label> </fieldset> <fieldset> <legend>Linki do kont</legend> <?php $banks = ['Santander', 'mBank', 'PEKAO SA', 'BNP', 'PKO BP', 'Alior', 'Nest Bank', 'Millennium', 'Citi Handlowy', 'VeloBank']; foreach ($banks as $bank) { $bank_key = strtolower(str_replace(' ', '_', $bank)) . '_link'; echo '<label>' . $bank . ' ID: <input type="url" name="' . $bank_key . '" value="' . esc_attr(get_user_meta($current_user->ID, $bank_key, true)) . '"></label>'; } ?> </fieldset> <fieldset> <legend>Linki partnerskie</legend> <label>Link do polecania strony: <input type="url" name="referral_link" value="<?php echo esc_attr(get_user_meta($current_user->ID, 'referral_link', true)); ?>"></label> </fieldset> <input type="submit" class="save-button" name="save_profile" value="Zapisz"> </form> </div> <div id="settings" class="tab-content"> <h3>Ustawienia</h3> <form method="post" class="settings-form" id="settings-form"> <?php wp_nonce_field('upp_save_settings_action', 'upp_save_settings_nonce'); ?> <fieldset> <legend>Opcje Ustawień</legend> <label> <input type="checkbox" name="notifications" <?php checked(get_user_meta($current_user->ID, 'notifications', true), '1'); ?>> Otrzymuj powiadomienia </label> <!-- Usunięto opcję "Włącz tryb ciemny" --> </fieldset> <fieldset> <legend>Zresetuj hasło</legend> <label>Nowe hasło: <input type="password" name="new_password" required></label> <label>Potwierdź nowe hasło: <input type="password" name="confirm_password" required></label> </fieldset> <input type="submit" class="save-button" name="save_settings" value="Zapisz Ustawienia"> </form> </div> </div> <?php } // Obsługuje zapisywanie danych po wysłaniu formularza public function handle_form_submissions() { if (isset($_POST['save_profile'])) { $this->save_profile(); } if (isset($_POST['save_settings'])) { $this->save_settings(); } } // Funkcja zapisu danych profilu private function save_profile() { if (!isset($_POST['upp_save_profile_nonce']) || !wp_verify_nonce($_POST['upp_save_profile_nonce'], 'upp_save_profile_action')) { die('Nieautoryzowane żądanie.'); } $current_user = wp_get_current_user(); // Sprawdzenie i zapisanie zdjęcia if (isset($_FILES['avatar']) && $_FILES['avatar']['error'] === UPLOAD_ERR_OK) { $uploaded_file = $_FILES['avatar']; $upload_overrides = ['test_form' => false]; $movefile = wp_handle_upload($uploaded_file, $upload_overrides); if ($movefile && !isset($movefile['error'])) { update_user_meta($current_user->ID, 'avatar', $movefile['url']); } else { echo $movefile['error']; } } // Zapisanie pozostałych danych $full_name = sanitize_text_field($_POST['full_name']); list($first_name, $last_name) = explode(' ', $full_name, 2); update_user_meta($current_user->ID, 'first_name', $first_name); update_user_meta($current_user->ID, 'last_name', $last_name); update_user_meta($current_user->ID, 'm2m_id', sanitize_text_field($_POST['m2m_id'])); update_user_meta($current_user->ID, 'distributor_id', sanitize_text_field($_POST['distributor_id'])); update_user_meta($current_user->ID, 'fb_link', esc_url_raw($_POST['fb_link'])); // Zapisanie linków do banków $banks = ['Santander', 'mBank', 'PEKAO SA', 'BNP', 'PKO BP', 'Alior', 'Nest Bank', 'Millennium', 'Citi Handlowy', 'VeloBank']; foreach ($banks as $bank) { $bank_key = strtolower(str_replace(' ', '_', $bank)) . '_link'; update_user_meta($current_user->ID, $bank_key, esc_url_raw($_POST[$bank_key])); } update_user_meta($current_user->ID, 'referral_link', esc_url_raw($_POST['referral_link'])); // Potwierdzenie echo '<div class="updated"><p>Profil został zapisany.</p></div>'; } // Funkcja zapisu ustawień private function save_settings() { if (!isset($_POST['upp_save_settings_nonce']) || !wp_verify_nonce($_POST['upp_save_settings_nonce'], 'upp_save_settings_action')) { die('Nieautoryzowane żądanie.'); } $current_user = wp_get_current_user(); $notifications = isset($_POST['notifications']) ? '1' : '0'; update_user_meta($current_user->ID, 'notifications', $notifications); // Zapisanie nowego hasła if (!empty($_POST['new_password']) && $_POST['new_password'] === $_POST['confirm_password']) { wp_set_password($_POST['new_password'], $current_user->ID); echo '<div class="updated"><p>Hasło zostało zaktualizowane.</p></div>'; } } // Dodajemy style CSS public function add_styles() { ?> <style> .popup { position: absolute; z-index: 9999; width: 300px; border: 1px solid #333; background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); } .popup-content { padding: 15px; } .close-popup { background: transparent; border: none; cursor: pointer; font-size: 16px; float: right; } .tab-button { cursor: pointer; padding: 10px; margin-right: 5px; background: #ddd; border: none; } .tab-button.active { background: #bbb; } .tab-content { display: none; } .tab-content.active { display: block; } .save-button { background-color: #28a745; color: white; border: none; padding: 10px 15px; cursor: pointer; } .save-button:hover { background-color: #218838; } /* Media query dla urządzeń mobilnych */ @media (max-width: 768px) { #user-profile-button { position: relative; /* lub relative */ right: -8px; /* Przesunięcie przycisku w prawo */ top: 75px; /* Przesunięcie przycisku w dół */ padding: 15px 20px; /* Zwiększenie rozmiaru przycisku */ font-size: 18px; /* Zwiększenie czcionki przycisku */ } .popup { width: 90%; /* Dostosowanie szerokości popupu na urządzeniach mobilnych */ } } </style> <?php } // Skrypt do zamykania popupu public function add_dark_mode_script() { ?> <script> jQuery(document).ready(function($) { $('#user-profile-button').on('click', function() { $('#user-profile-popup').toggle(); }); $('#close-popup').on('click', function() { $('#user-profile-popup').hide(); }); $('.tab-button').on('click', function() { $('.tab-button').removeClass('active'); $(this).addClass('active'); $('.tab-content').removeClass('active'); $('#'+$(this).attr('onclick').match(/'([^']+)'/)[1]).addClass('active'); }); }); </script> <?php } - Assistant
Na podstawie przedstawionego przez Ciebie kodu, zasugeruję kilka poprawek, które mogą rozwiązać problem z uciętym przyciskiem w wersji mobilnej: