Featured Idea - Last Logged In...

Re: [rjbathgate] Featured Idea - Last Logged In...

By Dave - April 29, 2011

Hi Rob,

We also added it in 2.08 as a default field under User Accounts that is also updated when you login to the CMS.

Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Featured Idea - Last Logged In...

By rjbathgate - May 1, 2011

bonza, thanks :)

Re: [Dave] Featured Idea - Last Logged In...

By gversion - March 20, 2012

Hi David,

I can see the field "Last Login", which is great!

Can you tell me how I can setup this to be included as an "Advanced Search" field so that I can list all users that haven't logged in since a particular date?

Or to put it another way, I'd like to be able to list all users that logged in before a certain date and all users that logged in after a certain date.

Thank you,
Greg

Re: [gversion] Featured Idea - Last Logged In...

By Dave - March 20, 2012

Hi Greg,

First, turn on the "Date Picker" feature under: Admin > General Settings > Use Datepicker (was was added in 2.14 and isn't required)

Next, edit the accounts section and click on "Search"
/cmsAdmin//admin.php?menu=database&action=editTable&tableName=accounts#search

Add these lines
_all_
Last Login Before|lastLoginDate|max
Last Login After|lastLoginDate|min

Then go to your accounts editor:
/cmsAdmin/admin.php?menu=accounts

Click "Advanced Search >>", click on the date fields, then click search.

One last tip, if you add "lastLoginDate" to the list of fields to be displayed on the list page it will be easier to confirm the matching is working correctly (it seemed to do so in my quick tests).

Let me know how it goes. Cheers! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Featured Idea - Last Logged In...

By gversion - March 20, 2012

Hi Dave,

Thanks for your advice.

I have turned on Date Picker but the date icon is not appearing... any ideas what might be the problem? The "lastLoginDate" field type is setup to be "date/time" and there is a tick in the box allowing the user to specify a time and a tick in the "seconds" box too.

Also, do I need to include the first line you mentioned?
_all_

Is this just so I can do keyword search on any field or is it required for the lastLoginDate search to work?

Thank you,
Greg

Re: [gversion] Featured Idea - Last Logged In...

By Dave - March 20, 2012

Hi Greg,

You don't need the _all_ on the first line and can remove that if needed. It's just for keywords searches.

The date icon doesn't appear on those search fields but I've added it to the next release.

If you are comfortable modifying PHP code you can try adding it yourself. Just open /cmsAdmin/lib/menus/default/list_functions.php then:
- Search for: jqueryUI
- Replace this
// custom datepicker code - this is only called is jqueryUI datepicker is loaded
$html .= "\n<script type='text/javascript'>";
$html .= " $(function() { ";
$html .= " if ($.datepicker != undefined) { $('[name={$name}]').datepicker({ dateFormat: 'yy-mm-dd' }); }";
$html .= " });";
$html .= "</script>\n";
}

- With this:
// custom datepicker code - this is only called is jqueryUI datepicker is loaded
$jsDateFormat = @$fieldSchema['showTime'] ? "yy-mm-dd 00:00:00" : "yy-mm-dd";
$html .= <<<__HTML__
<script type='text/javascript'><!--
$(function() {
if ($.datepicker != undefined) {
$('[name={$name}]').datepicker({
showOn: 'button',
buttonImage: '3rdParty/jqueryUI/calendar.gif',
buttonImageOnly: true,
dateFormat: '$jsDateFormat'
});
}
});
//--></script>
__HTML__; // make sure there are no spaces to the left of __HTML__;
}


Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com