I suggested to use a model instead of this template stuff…
Create a members page in /content
with a members.txt
and then this model members.php
<?php
class MembersPage extends Page
{
public function children()
{
$usersPages = [];
$users = kirby()->users();
foreach ($users as $key => $user) {
$userPages[] = [
'slug' => Str::slug($user->id()), // or username if unique
'num' => $user->indexOf($users),
'template' => 'member',
'model' => 'member',
'content' => [
'title' => $user->username(),
// more fields here
]
];
}
return Pages::factory($userPages, $this);
}
}
Then you can list them in your member.php template and the children work like a normal page with their own url.