Re: [zip222] Create a log of member logins?
Hi zip222,
Maybe I can help without sending you to consulting. If this doesn't work for you, please send in a request for a quote and we'll be happy to get back to you as soon as possible.
Create a Multi Record section called "Login Log". Modify it and remove all the fields except "num" and "createdDate" (note that you'll need to "Enable System Field Editing" under the "Advanced Commands..." dropdown to remove some of the fields.) Add a List Field called "Who". Modify your "Who" field as follows:
List Options: Get options from database (advanced)
Section Tablename: accounts
Use this field for option values: num
Use this field for option labels: username
Now, make some more changes to your Login Log section, this time at the top of the page:
In the General tab, change "ListPage Fields" to "createdDate, who". Under the Viewer Urls tab, change "Filename Fields" to "". Under the Searching tab, set "Search Fields" to "who, createdDate". Finally, under the Sorting tab, set "Order By" to "createdDate DESC". Now click Save Details.
Now open up cmsAdmin/plugins/websiteMembership/websiteMembership.php in a text editor and find "redirect on success". Add the code in red before "redirect on success":
// CUSTOM CODE! add record to login_log
global $TABLE_PREFIX;
mysql_query(mysql_escapef("INSERT INTO {$TABLE_PREFIX}login_log SET createdDate = NOW(), who = ?", $CURRENT_USER['num']))
or die("Mysql error adding login_log record: ". htmlspecialchars(mysql_error()) . "\n");
// redirect on success
I hope this helps! Please let me know if you have any questions.
All the best,
Chris