This is a quick tutorial on how to modify the new Member Database. It's more module driven (I guess it could be called OO, although it's not technically written that way I don't think).
To save new member fields simply do the following:
|
Code
SaveMemberID( 'memberid', %addtoID = ( 'name1' => 'value1', 'name2' => 'value2' ) ); |
|
You can also specify the names and values before calling SaveMemberID, such as:
|
Code
$addtoID{'name1'} = "value1"; $addtoID{'name2'} = "value2";
SaveMemberID('memberid'); |
|
or:
|
Code
%addtoID = ( 'name1' => 'value1'; 'name2' => 'value2';
SaveMemberID('memberid'); |
|
It's just a simple hash. Once SaveMemberID is called the hash is destoryed. So DO NOT try to gather these values later on because they won't be there.
If a value is blank, the name WILL NOT be written to the .dat file (so there won't be blank values which take up space on the server and are wasteful).
If you want to get the member data:
You DO NOT need to call GetMemberID before saving. When SaveMemberID is called the old hash refrence is destoryed, and the data is retrieved all over again. This creates a hash refrence with the members data:
This can be taken this way:
|
Code
$memberid{'memberid'}{'name1'} |
|
I'm not really sure why anyone would need to use the hash refrence in basic coding though.
Hope this helps someone in adding new items to member data. It's MUCH easier to manage than the old way ... much easier.

Oh, one last thing, $username data is stored and retrieved the same way:
|
Code
$memberid{$username}{'name1'} |
|
There's no longer seperate items for members and normal users. This is a HUGE change, and that's why there were a lot of bugs yesterday.
DO NOT store names with spaces (ie: 'value 1'), either up an underscore or no space (ie: 'value_1' or 'value1').
If you are saving member data and then want to call it again WITHOUT a refresh, call:
|
Code
GetMemberID('memberid','force'); |
|
If 'force' is not there you WILL get old member data.
- Justin