View Full Version : DataManager question(s)
ltwinnerr
09-06-2011, 04:23 PM
I want to use a datamanager to save some custom fields. However I am unsure about one or two things.
1. What is the difference between the vB_DataManager set() and setr() functions? Why would I use one instead of the other?
2. What is the purpose of the setinfo() function? Why would you use this function instead of using set()?
1. What is the difference between the vB_DataManager set() and setr() functions? Why would I use one instead of the other?
The setr() will save a reference to the value you pass, which means that it will "point to" the same data instead of making a copy. I believe it's used for efficiency, to keep from making a new copy of every data field. It also has the effect that any changes to the variable you pass that are made after the call to setr() will affect the value that the data manager has saved, but it would probably be a bad idea to use it for that purpose since things could get confusing.
If you don't know what references are it might help to look this over: http://us2.php.net/manual/en/language.references.php
2. What is the purpose of the setinfo() function? Why would you use this function instead of using set()?
I'm not 100% sure, but it looks like the set_info() function is used to pass values to the data manager other than the actual values that will be saved. For instance if the user dm needed to know the value of a certain option to process the user info, but that option isn't part of the actual user data, you'd set it with set_info() instead of set().
ltwinnerr
09-06-2011, 10:15 PM
ty mate
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.