PHPMaker handles very good the important user profile information, such as: the last accessed date time, the login retry count, the last bad login date time, and the last password changed date, by saving them only in one field that generally called with UserProfile. For your information, you can use this UserProfile if you have activated the related field from the "Profile field (memo)" directive in your PHPMaker application -> Security -> Advanced Security -> User Login Options. By using this UserProfile field, you are able to retrieve those information above easily and quickly only from one field.
Unfortunately, PHPMaker has not included the other three important user profile information, yet; such as the last login date time, the last logout date time, and the registered date. I am sure you will also need this information so you will know when your users are registered, when your users the last time are logged in, and when your users are logged out in your website. This following modification will add this additional information by optimizing the existing UserProfile field. Imagine now, you are able to save any important user profile information into this UserProfile field only!
[hidepost]
-
Open your /Script/ewcfg.php file, and find this code:
// Email define("EW_EMAIL_COMPONENT", strtoupper("<!--##=PROJ.EmailComponent##-->"), TRUE);before the first line of that code, please insert this following code:
// Begin of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011 define("EW_USER_PROFILE_REGISTERED_DATE_TIME", "RegisteredDateTime", TRUE); define("EW_USER_PROFILE_LAST_LOGIN_DATE_TIME", "LastLoginDateTime", TRUE); define("EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME", "LastLogoutDateTime", TRUE); // End of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011 -
Open your /Script/phpfn.php file, and find this code:
<!--## If bCheckLoginRetry Then ##--> // Max login retry $this->Profile[EW_USER_PROFILE_LOGIN_RETRY_COUNT] = 0; $this->Profile[EW_USER_PROFILE_LAST_BAD_LOGIN_DATE_TIME] = ""; <!--## End If ##-->
after the last line of that code, please insert this following code:
// Begin of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011 $this->Profile[EW_USER_PROFILE_REGISTERED_DATE_TIME] = ""; $this->Profile[EW_USER_PROFILE_LAST_LOGIN_DATE_TIME] = ""; $this->Profile[EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME] = ""; // End of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011
-
Open your /Script/login.php file, and find this code:
<!--## If bCheckConcurrentUser Then ##--> setcookie(EW_PROJECT_NAME . '[' . EW_USER_PROFILE_SESSION_ID . ']', session_id(), EW_COOKIE_EXPIRY_TIME); // Save current Session ID <!--## End If ##-->
after the last line of that code, please insert this following code:
// Begin of modification by Masino Sinaga, for saving the last login date time, November 6, 2011 $UserProfile->Profile[EW_USER_PROFILE_LAST_LOGIN_DATE_TIME] = ew_StdCurrentDateTime(); $UserProfile->SaveProfileToDatabase($this->Username); // End of modification by Masino Sinaga, for saving the last login date time, November 6, 2011
-
Open your /Script/logout.php file, and find this code:
$sUsername = $Security->CurrentUserName();
after that line, please insert this following code:
// Begin of modification by Masino Sinaga, for saving the last logout date time, November 6, 2011 $UserProfile->Profile[EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME] = ew_StdCurrentDateTime(); $UserProfile->SaveProfileToDatabase($sUsername); // End of modification by Masino Sinaga, for saving the last logout date time, November 6, 2011
-
Open your /Script/register.php file, and find this code:
global $conn, $Security, $Language, $gsFormError, $objForm, $<!--##=gsTblVar##-->;then replace it with this following code:
global $conn, $Security, $Language, $gsFormError, $objForm, $<!--##=gsTblVar##-->, $UserProfile; // $UserProfile added by Masino Sinaga, November 6, 2011 -
Still in the /Script/register.php file, find again this code:
<!--## If PROJ.SecRegisterActivate Then ##--> $this->setSuccessMessage($Language->Phrase("RegisterSuccessActivate")); // Activate successbefore the first line of that code, please insert this following code:
// Begin of modification by Masino Sinaga, for saving the registered date time, November 6, 2011 $UserProfile->Profile[EW_USER_PROFILE_REGISTERED_DATE_TIME] = ew_StdCurrentDateTime(); $UserProfile->SaveProfileToDatabase($<!--##=gsTblVar##-->->Username->CurrentValue); // End of modification by Masino Sinaga, for saving the registered date time, November 6, 2011
[/hidepost]
I am getting this error:
Undefined property: clogout::$Username in /Applications/MAMP/htdocs/gms.drc.dk/app/logout.php on line 205
changing $UserProfile->SaveProfileToDatabase($this->Username);
to
$UserProfile->SaveProfileToDatabase($sUsername);
seems to fix the problem. Can you please check?
I get also this error on registration:
Undefined property: cuser::$Username in /Applications/MAMP/htdocs/gms.drc.dk/app/register.php on line 792
$UserProfile->SaveProfileToDatabase($employees->Username->CurrentValue);
this seems problematic, also the name of my table is “user” not employees …
Thanks. Already fixed it with the following code:
Thanks for bringing this issue up. Already fixed it with the following code: