subscribe : fix date saving, duplicate detection and display format
All checks were successful
Deploy / Deploy to Production (push) Successful in 10s
All checks were successful
Deploy / Deploy to Production (push) Successful in 10s
Fix inscription date key to lowercase for Kirby compatibility, fix duplicate email check using array_column, change date display to DD/MM/YYYY, and sort subscribers by inscription date. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
641ddc3fdd
commit
b2139d8f40
2 changed files with 4 additions and 5 deletions
|
|
@ -12,15 +12,14 @@ tabs:
|
|||
subscribers:
|
||||
label: Abonnés
|
||||
type: structure
|
||||
sortBy: email asc
|
||||
sortBy: inscriptionDate desc
|
||||
fields:
|
||||
email:
|
||||
type: email
|
||||
inscriptionDate:
|
||||
label: Date d'inscription
|
||||
type: date
|
||||
display: MM/DD/YYYY
|
||||
default: today
|
||||
display: DD/MM/YYYY
|
||||
- width: 1/3
|
||||
sections:
|
||||
newsletters:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ return [
|
|||
$page = page('lettre');
|
||||
$subscribers = $page->subscribers()->yaml();
|
||||
|
||||
$emailExists = in_array(['email' => $email], $subscribers);
|
||||
$emailExists = in_array($email, array_column($subscribers, 'email'));
|
||||
|
||||
if ($emailExists) {
|
||||
return [
|
||||
|
|
@ -24,7 +24,7 @@ return [
|
|||
|
||||
$newSubscriber = [
|
||||
'email' => $email,
|
||||
'inscriptionDate' => date('Y-m-d')
|
||||
'inscriptiondate' => date('Y-m-d')
|
||||
];
|
||||
$subscribers[] = $newSubscriber;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue