autopopulate column based on who’s logged in? [SOLVED]
Archived from the Xataface Users forum.
cantlep — Wed Sep 01, 2010 4:14 am
Hi There,
is there anyway to automatically populate a field (i.e. a Username field) with the name of the user that’s currently logged in?
What I’m after is that when a user logs in and creates a new record. Their username is auto added to a field (which I’ll hide later on).
Thanks
Paul
cantlep — Wed Sep 01, 2010 7:01 am
Sorted:
Found some old posts which helped:
- Code: Select all
function beforeInsert(&$record){ $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUsername(); //$record->setValue('UserName', $user->val('UserName')); $record->SetValue('UserName', $user); }
Did the trick