forked from Adleraci/adlerka.top
autoload user info
This commit is contained in:
parent
88b1391b34
commit
c4a9dd9593
@ -112,9 +112,12 @@ function getPage($page_name = null): array|false|string
|
|||||||
$page_title = $page_name;
|
$page_title = $page_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dynastyle = "<style>";
|
||||||
if(isLoggedIn() && !empty($_SESSION["favorite_color"]) && is_int($_SESSION["favorite_color"]) && $_SESSION["favorite_color"] <= 4294967295){
|
if(isLoggedIn() && !empty($_SESSION["favorite_color"]) && is_int($_SESSION["favorite_color"]) && $_SESSION["favorite_color"] <= 4294967295){
|
||||||
$dynastyle = dechex($_SESSION["favorite_color"]);
|
$color = dechex($_SESSION["favorite_color"]);
|
||||||
|
$dynastyle .= "--root{ --favorite-color: #$color;";
|
||||||
}
|
}
|
||||||
|
$dynastyle .= "</style>";
|
||||||
|
|
||||||
$navpages = generateNavigation();
|
$navpages = generateNavigation();
|
||||||
|
|
||||||
|
@ -8,9 +8,7 @@
|
|||||||
<script src="/assets/script.js"></script>
|
<script src="/assets/script.js"></script>
|
||||||
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
|
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
|
||||||
<title>Adlerka __TEMPLATE_PAGE_TITLE__</title>
|
<title>Adlerka __TEMPLATE_PAGE_TITLE__</title>
|
||||||
<style>
|
|
||||||
__TEMPLATE__DYNASTYLE__
|
__TEMPLATE__DYNASTYLE__
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
__TEMPLATE__NAV__
|
__TEMPLATE__NAV__
|
||||||
|
@ -41,17 +41,29 @@
|
|||||||
doAccountAction(data, "Email update Successful!", "Email update failed.");
|
doAccountAction(data, "Email update Successful!", "Email update failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function populateUserInfoFields(userData) {
|
||||||
|
document.getElementById("updateFirstName").value = userData.first_name || "";
|
||||||
|
document.getElementById("updateLastName").value = userData.last_name || "";
|
||||||
|
document.getElementById("updateNickname").value = userData.nickname || "";
|
||||||
|
document.getElementById("updateMinecraftNick").value = userData.minecraft_nick || "";
|
||||||
|
document.getElementById("updateNewEmail").value = userData.Email || "";
|
||||||
|
}
|
||||||
|
|
||||||
async function getUserInfo() {
|
async function getUserInfo() {
|
||||||
const data = new URLSearchParams();
|
const data = new URLSearchParams();
|
||||||
data.append("action", "get_user_info");
|
data.append("action", "get_user_info");
|
||||||
|
|
||||||
const result = await doAccountAction(data, "User info retrieved Successfully!", "User info retrieval failed.");
|
const result = await doAccountAction(data, "User info retrieved Successfully!", "User info retrieval failed.", true);
|
||||||
|
|
||||||
if (result && result.Status === "Success") {
|
if (result && result.Status === "Success") {
|
||||||
displayUserInfo(result.UserInfo);
|
populateUserInfoFields(result.UserInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
getUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
function displayUserInfo(userData) {
|
function displayUserInfo(userData) {
|
||||||
const tableContainer = document.getElementById("userInfoTable");
|
const tableContainer = document.getElementById("userInfoTable");
|
||||||
tableContainer.innerHTML = ""; // Clear previous content
|
tableContainer.innerHTML = ""; // Clear previous content
|
||||||
@ -75,6 +87,7 @@
|
|||||||
|
|
||||||
tableContainer.appendChild(table);
|
tableContainer.appendChild(table);
|
||||||
}
|
}
|
||||||
|
window.onload = init();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Centralized Status Message -->
|
<!-- Centralized Status Message -->
|
||||||
|
Loading…
Reference in New Issue
Block a user