[Home]LoadUserData

UseModWiki | RecentChanges | Preferences

UseModWiki/Documentation: Functions: LoadUserData

Loads from a file a bunch of data about user preferences into the hash %UserData

Note user data is stored in the file system seperately from the wiki pages, and is by $UserID. Note UserID value 112 is used as a sentinel value to signify that no data is available. The UserId? is normally available from a cookie (retrieved by &InitCookie) User ID value 111 is used as an error value that UserID is out of range. (ie: UserID values start at 200) User ID value 113 is used as an error value signifying the retrieved cookie and the known user id info is out of sync.

 sub LoadUserData {
   my ($data, $status);

   %UserData = ();
   ($status, $data) = &ReadFile(&UserDataFilename($UserID));
   if (!$status) {
     $UserID = 112;  # Could not open file.  Later warning message?
     return;
   }
   %UserData = split(/$FS1/, $data, -1);  # -1 keeps trailing null fields
 }


UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited April 22, 2007 9:28 pm by MarkusLude (diff)
Search: