Userdata functions
From Sohowiki
Revision as of 16:32, 9 August 2006 by 216.107.76.114 (Talk)
Contents |
Introduction
The idea behind the userdata class is to make it easy for plugin developers to store and retrieve basic user-inputted information for use with their plugin --- account ids, display preferences, etc. --- without having to create a whole db table for it.
When to use it
If you're developing a plugin and find yourself about to create a whole db table just to store one row's worth of misc information related to your plugin, stop, follow the vague memory of this sentence back to this page, and check out this userdata method. Less lines of code, fewer keystrokes, no worrying about creating and installing the db in the install manifest.
Do this first
$sitepal = new userdata("sitepal");
Storing information
$sitepal->set("account_id", $_POST['account_id']); $sitepal->set("username", $_POST['username']); $sitepal->set("password", $_POST['password']);
Retrieving information()
$getSp = $sitepal->get();