Sort Virtual Pages

I’ve created virtual Pages for each User Account which has the role ‘artist’. Is it possible to sort the Virtual Pages? So that I am able to manage the order of the pages?

This is very little information. Please provide more information about what you are actually doing and how and what you want to achieve in detail.

I guess you want to manually sort the virtual pages in the Panel? That would only make sense if you store your sorting numbers somewhere.

The Artist users are getting created like this:

 $newUser = User::create([
                            'email'     =>  $email,
                            'name'      => $artist->title(),
                            'role'      => 'artist',
                            'language'  => 'de',
                            'password'  => 'topSecret',
                            'content'   => [
                                'position'  => 'artist',
                                'allowed_page_uuid' => $artist->uuid(), // Set the allowed page UUID

Now every Artist is getting a Virtual Page:

class ArtistsPage extends Kirby\Cms\Page
    public function children(): Pages
        if ($this->children instanceof Pages) {
            return $this->children;

        $artists = [];

        foreach (kirby()->users()->filterBy('role','artist') as $artist) {
            $artists[] = [
                'slug'     => (Str::slug($artist->name())),
                'num'      => 0,
                'template' => 'artist',
                'model'    => 'artist',
                //'files'    => $comment ? $comment->files()->toArray() : null,
                'content'  => [
                    'mainimage' => $artist->images()->filterBy('template', 'mainimage'),
                    'large' => $artist->images()->filterBy('template', 'large'),
                    'gallery' => $artist->images()->filterBy('template', 'gallery'),
                    'text'  => $artist->name(),
                    'user'  => $artist->name(),
                    'since' => $artist->since(),
                    'posid' => $artist->positionid(),
                    'tags' => $artist->tags(),
                    'description' => $artist->description(),
                    'uuid'  => Uuid::generate(),

        return $this->children = Pages::factory($artists, $this);

Now: How would you recommend achieving the sorting numbers? I want to list the Account Pages in a specific order. The later the user is generated, the further back they should appear in the list.

is there anything I can do?

When creating a user, save their creation date in the user file. The sort them by date, applying this creation date as num prop.

Am I able to add the creation date automatically? So that I can create the user via the frontend?

is that possible?

Wait, you wrote above you are creating the users programmatically on the frondend, right? So all you need to do is add a new content field in your content array with the current date/datetime.

For the Panel, I would make this either a hidden or readonly field in the user blueprint. If you create your users via the Panel, set the default value of this creation date field to “now”

    label: Created on
    type: date
    time: true
    default: now