If you are using User Groups for Runtime Security login:Then you will have to implement a global macro, such as the previous replies suggested. The reason is because you can only configure one set of login/logout macros for the entire group, so you need a different method that uniquely writes values to the controller.
Create a macro named "Macro1" that writes the user name to the controller, whenever a new user is logged in. You will also want to store the currently logged in username into a temp tag, such as an HMI memory tag ("HMITag_LastUser)
If CurrentUserName( ) <> HMITag_LastUser Then CurrentUserName( ) Else HMITag_LastUser
Click to view attachmentDefine the Global Connection for "Remote Macro1" to trigger anytime a new user logs in.
If CurrentUserName( ) <> HMITag_LastUser Then 1 Else 0
Click to view attachmentIf you have individual users configured in Runtime Security:Then use either/both the login/logout macros. The key there is to use a different macro for each user, and do not use the "CurrentUserName" or other security functions (the login/logout macros execute asynchronously to the login event, so you cannot be certain the security functions will be updated at that time). Instead, hardcode either the username or a numeric identifier into the macro and write that value to the controller.
Click to view attachmentLet us know how it works out.