TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Logins do not count
  • Hey to all,

    Logins field in standart Users table do not updates or counts. It's just has a 0 value. But it worked before moving to another hosting. No errors in logs.

    Who knows what the problem is?

  • What about last_login field? Is it updating?

    Would you please provide Kohana version? Old hosting PHP version and new hosting PHP version? MySQL versions?

  • Hey @enov,

    last_login updates as usual.
    Using Kohana 3.3.0.
    Old and new hosting has PHP Version 5.3.27.
    MySQL Client API version 5.5.28

  • It happens to me too.

    kohana 3.3.1. MySQL 5.5.27. vista and xp. xampp 1.8.1.

  • Interesting... The code for updating last_login and logins is in Model_Auth_User:

        public function complete_login()
        {
            if ($this->_loaded)
            {
                // Update the number of logins
                $this->logins = new Database_Expression('logins + 1');
    
                // Set the last login date
                $this->last_login = time();
    
                // Save the user
                $this->update();
            }
        }
    

    Perhaps new Database_Expression('logins + 1') not behaving correctly?

    @srs, @dov, let's try to override that function via CFS, by extending Model_Auth_User:

    class Model_User extends Model_Auth_User {
    
        public function complete_login()
        {
            if ($this->_loaded)
            {
                // Update the number of logins
                $this->logins += 1; // new Database_Expression('logins + 1');
    
                // Set the last login date
                $this->last_login = time();
    
                // Save the user
                $this->update();
            }
        }
    
    }
    

    Any hope with this?


    By the way, I can not access redmine dev.kohanaframework.org: 502 bad gateway

  • @enov,

    I did it after I realized the logins do not counts. I put the same code in my model and it works. Just wanted to know, why it doesn't work in the system...

  • @srs, so basically, we have:

    $this->logins += 1; // working
    
    $this->logins = new Database_Expression('logins + 1'); // not working
    

    Right? Could you please take some time and confirm this on a clean Kohana installation? with a clean ORM and Auth modules? @dov could you confirm too?

    I can not access dev.kohanaframework.org to see if there is anything related to this there.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

  • dov November 2013
  • enov November 2013
  • srs November 2013