Jump to content
TNG Community
Sign in to follow this  
Packrat

Last Login

Recommended Posts

Packrat

The code is setup as "SELECT realname, username, lastlogin FROM tng_users WHERE lastlogin IS NOT NULL"

But the results don't appear to be sorted properly. Some users who logged in just days ago are listed all the way at the bottom while other users who haven't logged in in years are near the top. How can I get the list to sort the logins with the most recent dates first and the later ones last?

Ken

Share this post


Link to post
Share on other sites
tngrlkrz

What code is setup? What version of TNG?  Are you referring to the Admin:Users screen?  All are sorted OK for me with or without an available mod Admin_Users_Menu which adds three columns/fields to the user report.  There is a dropdown for 'last login' and 'ascending, descending' for the sorted display. This is on TNG 12.03.

Ron

Share this post


Link to post
Share on other sites
Packrat

The Next Generation of Genealogy Sitebuilding, v.12.0.3

I am referring to Reports: This is the code, without the quotes: "SELECT realname, username, lastlogin FROM tng_users WHERE lastlogin IS NOT NULL" .

I don't have an Admin_Users_Menu mod.

 I don't see any dropdown menu for 'last login' and 'ascending, descending' . Just Search, Add New, Review and email.

Ken

 

Share this post


Link to post
Share on other sites
Packrat

I am using TNG  v.12.0.3. There are no dropdown menu for 'last login' and 'ascending, descending' Just Search, Add New, Review and E-mail

That's why I would like to have my users listed in descending order. I tried creating a report with this code: " SELECT realname, username, lastlogin FROM tng_users WHERE lastlogin IS NOT NULL"  which works but it doesn't list them in descending order. What do I need to do to the code to get it to list them in descending order?

Ken

Share this post


Link to post
Share on other sites
tngrlkrz

OK, I was referring to the online admin:users menu display. There is another mod besides the one I mentioned, that gives the sort capability: User_Sorting .  If you install that, you can sort the users online report. The other Admin_Users_Menu adds additional columns.

Ron

Share this post


Link to post
Share on other sites
Packrat

Any ideas where I can find this mod?

The download link is not working.

It says "the website daj.website cannot be found"

 

Ken

Share this post


Link to post
Share on other sites
tngrlkrz

Ken,

Not sure why that site is down, but have attached it here for you.

user_sorting_v10.1.0.1.zip

Just unzip to the /mods/ folder and it should work on TNG 12.03

Ron

Share this post


Link to post
Share on other sites
Packrat

Thank you Ron!

I guess that is just one the pitfalls of not having a centralized server for the downloads.

Ken

   
   

Share this post


Link to post
Share on other sites
Packrat

I don't know it still doesn't seem to be working. If I search Last Login and Ascending it goes from  2018 to 2014 to 2017 and back to 2018 again. If I searc for Last Login and Descending it goes from 2017 to to 2014 then to 2018 again.  It only seems to work if I am searching by username but that's pretty much pointless.

 

Thanks for all of your efforts.

Ken

Share this post


Link to post
Share on other sites
Ken Roy

 

15 minutes ago, Packrat said:

I guess that is just one the pitfalls of not having a centralized server for the downloads.

The centralized server is not the issue.  The issue is that the user is counting the downloads on his site and his site is currently not available

 

 

Share this post


Link to post
Share on other sites
Ken Roy
32 minutes ago, Packrat said:

I don't know it still doesn't seem to be working. If I search Last Login and Ascending it goes from  2018 to 2014 to 2017 and back to 2018 again. If I searc for Last Login and Descending it goes from 2017 to to 2014 then to 2018 again.  It only seems to work if I am searching by username but that's pretty much pointless.

I had to uninstall Alan Craxford's Sort User List mod since it conflicts with the User Sorting mod and from what I can tell this last mod does not sort several fields correctly, so I uninstalled it and revert back to Alan's Sort User List mod

Share this post


Link to post
Share on other sites
Packrat

Yeah, it doesn't seem to be working at all. So I'm back to my original question then:

I tried creating a report with this code: " SELECT realname, username, lastlogin FROM tng_users WHERE lastlogin IS NOT NULL"  which works but it doesn't list them in descending order. What do I need to do to the code to get it to list them in descending order?

 

Ken

Share this post


Link to post
Share on other sites
tngrlkrz

I don't use it much, but this report seems to be working for me.  Nothing out of sequence for last login.

SQL: SELECT personID, username, realname, email, description, disabled AS Active, date(lastlogin) as Last_Login FROM tng_users ORDER BY Last_Login DESC, Active DESC

Ron

Share this post


Link to post
Share on other sites
tngrlkrz

With a few changes, the attached version of the User_Sorting works fine for me on TNG 12.03 with one condition; I have bypassed the page by page display.  I didn't correct the issue of the sortorder reverting to the default 'description' on the 2nd and subsequent pages, so I essentially set the $maxsearchresults to an arbitrary number of 1000.  Another change was to put the date in yyyy-mm-dd format.  The mod seems to work with OK the other sort fields as well. 

It also works fine with the expanded columns added by the Admin_Users_Menu .   If the author doesn't chime in, maybe someone else can correct the multiple page issue with the mod.

Ron

user_sorting_v10.1.0.1a.cfg

Share this post


Link to post
Share on other sites
Newfloridian

Disclaimer: I haven't used Sort User List since the early days of TNG8. Indeed I didn't even realise it was still current. If memory serves me right this was an idea I tinkered with looking at a new coding idea before Mod Manager actually officially became Mod Manager. 

I rarely use Mod Manager anyway (only 9 mods currently listed) and I think Sort User List disappeared with the change to TNG10

Alan

 

Share this post


Link to post
Share on other sites
Packrat

Ron that SQL: SELECT personID, username, realname, email, description, disabled AS Active, date(lastlogin) as Last_Login FROM tng_users ORDER BY Last_Login DESC, Active DESC

is working perfectly for me. Thank you!

Now how could I change that to make the results ascending? Forgive me but I know nothing of making SQL statements.

Ken

Share this post


Link to post
Share on other sites
Ken Roy
2 hours ago, Newfloridian said:

Disclaimer: I haven't used Sort User List since the early days of TNG8. 

Alan,

Your mod still works, but the TNG Wiki page has not been updated to show it works past TNG v10.   I tried several times to get Darrin to add sort capability to the table headers like he has done in some scripts, but if others do not ask for that capability the enhancement stays low on his priority list

Share this post


Link to post
Share on other sites
tngrlkrz
3 hours ago, Packrat said:

Now how could I change that to make the results ascending?

Just remove the DESC (descending) after the orderby lastlogin, and it will default to ascending.

SELECT personID, username, realname, email, description, disabled AS Active, date(lastlogin) as Last_Login FROM tng_users ORDER BY Last_Login, Active DESC

Ron

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×