feat: bio profil + URL publique pré-remplie dans /profile
This commit is contained in:
@@ -1277,3 +1277,9 @@ footer.mt-5 { margin-top: 0 !important; }
|
||||
}
|
||||
|
||||
.author-profile-link:hover { color: var(--vl-accent); }
|
||||
|
||||
.author-profile-bio {
|
||||
max-width: 56rem;
|
||||
color: var(--vl-muted);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
+13
-5
@@ -1809,6 +1809,7 @@ switch ($action) {
|
||||
if ($newUrl !== '' && !filter_var($newUrl, FILTER_VALIDATE_URL)) {
|
||||
$newUrl = '';
|
||||
}
|
||||
$newBio = trim($_POST['bio'] ?? '');
|
||||
if ($newName === '') {
|
||||
$profileError = 'Le nom ne peut pas être vide.';
|
||||
} else {
|
||||
@@ -1817,11 +1818,11 @@ switch ($action) {
|
||||
try {
|
||||
$newSlug = slugify($newName);
|
||||
$st = $pdo->prepare(
|
||||
'INSERT INTO user_profiles (email, display_name, profile_url, profile_slug, updated_at)
|
||||
VALUES (:e, :n, :u, :s, now())
|
||||
ON CONFLICT (email) DO UPDATE SET display_name = :n, profile_url = :u, profile_slug = :s, updated_at = now()'
|
||||
'INSERT INTO user_profiles (email, display_name, profile_url, profile_slug, bio, updated_at)
|
||||
VALUES (:e, :n, :u, :s, :b, now())
|
||||
ON CONFLICT (email) DO UPDATE SET display_name = :n, profile_url = :u, profile_slug = :s, bio = :b, updated_at = now()'
|
||||
);
|
||||
$st->execute([':e' => currentUserEmail(), ':n' => $newName, ':u' => $newUrl, ':s' => $newSlug]);
|
||||
$st->execute([':e' => currentUserEmail(), ':n' => $newName, ':u' => $newUrl, ':s' => $newSlug, ':b' => $newBio]);
|
||||
$_SESSION['user_display_name'] = $newName;
|
||||
$profileSuccess = true;
|
||||
} catch (\Throwable $ex) {
|
||||
@@ -1831,7 +1832,14 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
$profileCurrentName = currentUserName();
|
||||
$profileCurrentUrl = authorProfileUrl(currentUserEmail() ?? '');
|
||||
$_profileData = authorProfile(currentUserEmail() ?? '');
|
||||
$profileCurrentUrl = $_profileData['url'];
|
||||
$profileCurrentBio = $_profileData['bio'];
|
||||
$profileCurrentSlug = $_profileData['slug'];
|
||||
// Pré-remplir l'URL avec l'URL de profil public si vide
|
||||
if ($profileCurrentUrl === '' && $profileCurrentSlug !== '') {
|
||||
$profileCurrentUrl = rtrim(APP_URL, '/') . '/profil/' . rawurlencode($profileCurrentSlug);
|
||||
}
|
||||
include BASE_PATH . '/templates/profile.php';
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user