Jump to content
teppo

Module: Process Login History

Recommended Posts

Whenever I edit a module in the modules directory and submit the changes it instantly grabs the new version number and code from Github. Of course you could even change the version number when editing, but it shouldn't be necessary

Share this post


Link to post
Share on other sites

Hi Teppo - thanks for the great module

In my setup for a site with membership - I set member user 'names' (not admins) with a numerical value to match their unique membership id for the organisation (not set within pw). 

Your module however logs users with a numerical 'name' as nonexistant, stores their $user->id as 0 and logs the login as a failure when it has been successful

Kind regards

Nik

Share this post


Link to post
Share on other sites

Just for the record, aforementioned issue is now fixed.

  • Like 1

Share this post


Link to post
Share on other sites

I have this installed on a project and was working fine until I wanted to open it up today and bamm

TemplateFile: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY username DESC' at line 4 SELECT DISTINCT username FROM ORDER BY username DESC<pre>#0 [internal function]: Database->query('SELECT DISTINCT...') #1 /home/www-data/*/wire/core/DatabaseMysqli.php(35): call_user_func_array(Array, Array) #2 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->__call('query', Array) #3 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->query('SELECT DISTINCT...') #4 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(159): ProcessLoginHistory->renderFilters() #5 [internal function]: ProcessLoginHistory->___execute() #6 /home/www-data/*/wire/core/Wire.php(365): call_user_func_array(Array, Array) #7 /home/www-data/*/wire/core/Wire.php(320): Wire->runHooks('execute', Array) #8 /home/www-data/*/wire/core/ProcessController.php(213): Wire->__call('execute', Array) #9 /home/www-data/*/wire/core/ProcessController.php(213): ProcessLoginHistory->execute() #10 [internal function]: ProcessController->___execute() #11 ...

This is on latest PW dev. There were no relevant changes as far as I can tell.

Share this post


Link to post
Share on other sites

After looking a little closer, the table name isn't set, so finally it looks like the module ProcessLoginHistoryHooks isn't installed/loaded although it's there, just not listed in the modules. Module refresh does not help. Strange, according to the entries in the table the last login was friday evening, when it suddenly stopped recording. I have no idea what's going on but heard others had problems with modules suddenly disapearing. :/

Share this post


Link to post
Share on other sites

I have no idea why but when I comments out

'requires' => 'ProcessLoginHistory'

in ProcessLoginHistoryHooks.module it suddenly works again. And the module is again listed in admin too. I add this line and it disappears :)

ProcessLoginHistory.module isn't autoload module, that's the only clue I can guess.

Share this post


Link to post
Share on other sites

@Soma: relatively easy "solution" would be forcibly loading the ProcessLoginHistoryHooks.module file in ProcessLoginHistory::construct, but I'd like to avoid that if possible -- feels like a hack, might not completely fix the issue, and I'd really like to know first why this is happening out of the blue. The symptoms made me wonder if it's just a question of load order (that's something I've had various issues with before), but on the other hand the hooks module not showing up in installed modules makes me wonder if it's something entirely different :)

I can't seem to reproduce anything you've mentioned here at the moment. I've heard of somewhat similar issues before (in fact just a few moments ago I replied to a report where similar issue was affecting my VersionControl module), so I believe that this is a real issue. Is there anything you can think of that could've caused this -- updates, environment changes, corrupted files (cache/other), automatic processes running wild, or something? Have you updated/installed other modules, perhaps using built-in tools or modules manager, or something?

Would love to get my hands on an installation where this "disappearing modules" error occurs, but it seems kind of random and usually only happens on real-world sites. So damn frustrating :)

For the time being I'm going to take a closer look at changes to Modules.php. Looks like there have been quite a few of those recently, so perhaps something is actually broken/changed..

Share this post


Link to post
Share on other sites

Last that I did at that time/day was install procache. Then I had troubles with Revive (AD tool) that we include in front-end banner scripts. It is setting UTC timezone due to a bug. So after that I did add script to set correct timezone after those scripts and it was working again. It's nothing that would be in backend only front-end scripts. But due to that procache wasn't porperly working and deleting cache all the time. At that time I think the issue popped up.

There were no major changes other than procache. The update to latest PW was before that day and I did a update today. 

So far I can't reproduce it anymore. I change it back to as it was and it's working. When the error appeared I did refresh, delete all caches (db, files) but no luck until I changed the module and removed the "requires". 

Never experienced something like it.  APC php cache is active on that server.

Share this post


Link to post
Share on other sites

Looks like it happened again. I installed a module via url. After that the Login History module had the same issue as I mentioned.

Edit: I have a local install (not same as the project) where I try to reproduce it but can't. Driving me crazy.

Share this post


Link to post
Share on other sites

Hi Teppo

Any plans to make this 3.0 compatible?

Hi Peter - I am using it here on PW3 and it's working just fine. Are you having any specific problems with it?

  • Like 2

Share this post


Link to post
Share on other sites

What Adrian said :)

If the question is whether I plan to release a separate 3.x version with namespace declarations in place, I honestly haven't even thought about that yet. On the other hand I do intend to support both 2.x and 3.x for the time being, so if this module isn't playing nicely together with the compilation feature of 3.x, please let me know.

  • Like 1

Share this post


Link to post
Share on other sites

+1 working fine on 3.x.   I use this on all my websites for a long time.

  • Like 1

Share this post


Link to post
Share on other sites
Acutally I've been meaning to post, I'm having an issue just so happened I saw this thread come to life :D
 
First, thankyou for such a great module Teppo!
 
Is anyone able to test if they have any issues viewing their user profile when logged in as themsleves, when this module is enabled?  Just want to know if its just my configuration, or something else I have conflicting with this module.
 
I can view other user profiles fine, it's only when looking at the user which is logged in.
 
Using PW 3.0.20
ProcessLoginHistory 1.2.8
 
Error code is attached.
 
Thanks!
 

post-3748-0-20373900-1465428811_thumb.pn

Share this post


Link to post
Share on other sites

Thanks for reporting this, @grimezy! One issue I can see right away is that date_diff() can indeed return "false" on failure, and this case is not properly handled by the code visible above. Real question, though, would be why this happens.

Mostly guessing from the error you're seeing and the code visible above, most probable cause would be some kind of an issue with $login_date, which in turn could either mean that login_timestamp row in database is empty or contains something unexpected.. or it could mean that $date_format is somehow broken.

I was unable to reproduce this issue based on a quick test and I'll have to step away for a few hours now, but I'll try to debug this further (hopefully) later today :)

  • Like 1

Share this post


Link to post
Share on other sites

Hey Teppo,

Thanks for the fast response.  Your correct in that it was the $login_date which was causing the issue.

In the LoginHistory settings for 'Date Format', I had inserted a character (-) separating the time and date.  Just removed this and works fine again.

Thanks for your help!

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for letting me know.. and good to hear it's working now :)

Share this post


Link to post
Share on other sites

This is the first time I heard of this module and it's freaking nice, thanks!

  • Like 2

Share this post


Link to post
Share on other sites

Hi Teppo

Any plans to make this 3.0 compatible?

My mistake. I meant to refer to ProcessChangelog.

I'll raise it and the error over on that support thread.

Share this post


Link to post
Share on other sites

Hi @teppo,

I recently thought about writing a small module to record the last login of a user, in order to show the user when he logged in the last time before the current login.
The data, which is necessary for this feature, is already built in your module.
What do you think, would that be a good addition to your module? So maybe a public function which just returns the second recent login. 

Just thought it may be useful for someone else, too.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...