Login to panel : Json notification

Hm :thinking:


Just on a side note: If you post code as code blocks instead of screenshots, it will be much more readable and useful for testing, correcting etc…

Sorry I’m a beginner… :flushed:

No worries, we love beginners :heart:

Have testing again and this IS clearly my connection to the database lines in my config.php file that takes a lot of ressource…

Is there an other way to stock informations of people who register for some meetings by completing a form with their name, email, phone… ?

You can store that information in Kirby’s text files instead of in a database. Or use an SQLite database.

@lukasbestle Any idea why a database connection in config would result in such an increase in resources?

@SimTheGeek Have I understood it correctly that the issue stops appearing once you comment out or remove the database connection options in your config.php, without any other changes to the site?

Could you please also explain where the error appears in particular? Once you load the login page or once the login form is submitted? Just with username/password login or also with code-based login?

Yes exactly @lukasbestle ! Everyting’s ok when I remove or comment my database connection code in my config.php file.
I tried only this without operate any changes on the site.

@lukasbestle the problems appear 5-6 few seconds after succefully loged in.
Like when lines connection to database are read on config.php file.

Is there someting particular to do on my database structure ? Here are my fields types :

Problem seems to be caused by my code in site > models > inscrits.php

<?php
    class InscritsPage extends Kirby\Cms\Page
    {
        public function children()
        {
            $inscrits = [];
            foreach ( Db::select('pat_ateliers_inscrits') as $inscrit ) {
                $inscrits[] = [
                    'slug'     => $inscrit->inscription_nom().'_'.$inscrit->inscription_prenom(),
                    'date'       => $inscrit->inscription_date(),
                    'atelier'    => $inscrit->inscription_atelier(),
                    'nom'        => $inscrit->inscription_nom(),
                    'prenom'     => $inscrit->inscription_prenom(),
                    'profession' => $inscrit->inscription_profession(),
                    'telephone'  => $inscrit->inscription_telephone(),
                    'email'      => $inscrit->inscription_email(),
                    'template'   => 'inscrits',
                    'model'      => 'inscrits'
                ];
            }
            return Pages::factory($inscrits, $this);
        }
    }

Ah, OK. So basically it happens when the Panel site view is loaded? I’m a bit confused as you wrote that it doesn’t happen if you reload the page. Have you tried reloading a few times – does it also sometimes occur after you are already logged in? Or really just on the first request after login?

Your database structure and model look fine to me. If there are really just 3-4 rows in that DB table, I cannot explain it to be honest.

Yes @lukasbestle the problem happens once when I log in… No problem after 5-6 page reloading.

I have creating a page model following guide on the kirby website. But maybe it’s not necessary in my case.
What is a model for exactly ???

Sorry i discover everyting… It’s such a fantastic CMS !!

A model is a child class of the Page class. It allows you to extend / overwrite the default class methods (further reading: A brief intro to object oriented programming in PHP | Kirby CMS)

For example, by default the subfolders in a page folder are the children. By redeclaring the children() method, content from other sources can become virtual children of a parent page.

Thanks for that explanation @pixelijn !
In my case is that truly relevant to have a model ? And I wonder if it’s also relevant to have a database…
Don’t know what’s best method to store and save my users registrations…

As already mentioned above, you can store your registrations as Kirby pages instead.

Or use a lightweight SQLite database.

The question remains why your database connection is so resource-hungry with just a few entries. That somehow doesn’t make sense.