jacem
Posts: 87
|
Posted: 06/26/2008, 5:20 PM |
|
In the event code for the Login button created by the CCS login builder, and immedaietly below the PHP code:
$Redirect = CCGetParam("ret_link", $Redirect);
$Login_Button_DoLogin_OnClick = 1;
add the code:
//custom code: update the lastlogin date & time
//It assumes a datetime field 'lastlogin' on your user / clients table.
$db =new clsDBMyAccountantsDB(); \\creates a pointer to the database
//set up the sql statement to execute using the sql funciton now() to provide the current
// date / time, sql takes care of using the right datetime format for your table
// Userid in my case is the users/clients email address
$SQL="UPDATE clients SET `LastLogin`=now() WHERE `Email`='".
.$Container->login->Value."'"; //$Container->login->Value is your users userid
$db->query($SQL); //execute the sql
$db->close(); //close the connection to the database
Hope this helps someone...
|
|
|
GabrielAkoh
Posts: 9
|
Posted: 09/03/2008, 4:29 AM |
|
I have a Similar problem, but your codes above may not help.
In my case, I want to update a hidden field on update of another using editable grid. The hidden field updatedby should equal current user as soon as a particular field is changed.
Please, bail me out.
Regards.
|
|
|
jacem
Posts: 87
|
Posted: 09/09/2008, 3:51 PM |
|
Actually I have the same problem in editable as you do at the moment.
I usually assign the field used to store the userid of th euser who has changed a record in the 'custom update' config (one of the properties for the editgrid form you are working on) to equal a session variable UserID (which Codecharge maintains with its authuntication login wizard). However I hae discovered that if a user changes just one record in a editable grid all the grid records get resaved even if they are unchanged.
Yessoftware will say this is not a bug but I think it is (and this has been discussed elsewhere along the lines of other areas of codecharge don't get triggered if an change is not made so why should unchanged editable grid records).
So you have to tie it to an event trigger when your 'watched' field changes to then update the userid field with the session variable UserID. Sadly the server side doesn't have a trigger event for changing a field (natually) so you need to store what the value was before displaying it and then check to see if it has changed during the after submit trigger.
No magic code snippit can be used - it is quite application dependant as I see it. But I am not an expert on CCS so the usual expert prowlers on this forum might jump in here to set you and I straight....hopefully
|
|
|
|