Userdata functions

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
m
(rv)
Line 1: Line 1:
[http://students.hsc.unt.edu/housing/item.cfm?type=2902 nextel ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=357 funny ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1347 but cialis] [http://library.cshl.edu/wp/vb/member.php?u=1365 cheap ultracet] [http://news.engin.brown.edu/forums/thread-view.asp?tid=210 sprint ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=158 diazepam online] [http://wc1.worldcrossing.com/WebX/.1de609ea free ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a25 free samsung ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=88 free free ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1358 cheap hydrocodone] [http://library.cshl.edu/wp/vb/member.php?u=1339 tramadol online] [http://students.hsc.unt.edu/housing/item.cfm?type=2868 cheap ambien] [http://news.engin.brown.edu/forums/thread-view.asp?tid=228 mtv ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=104 free motorola ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=89 free funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=211 free music ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=80 free cool ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1388 fioricet online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=361 real ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=172 online lorazepam] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=333 soma online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=182 cheap clomid] [http://library.cshl.edu/wp/vb/member.php?u=1355 clonazepam] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=205 order paxil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=184 cheap lisinopril] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=124 free samsung ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a04 free sonyericsson ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=115 phentermine online] [http://library.cshl.edu/wp/vb/member.php?u=1387 alltel ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a05 free sprint ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=167 cheap clonazepam] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30283 buy didrex] [http://news.engin.brown.edu/forums/thread-view.asp?tid=157 ultram online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=230 verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30309 cheap celexa] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=348 norco] [http://wc1.worldcrossing.com/WebX/.1de60a11 buy diethylpropion] [http://news.engin.brown.edu/forums/thread-view.asp?tid=188 tenuate online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=212 free verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30308 cheap lipitor] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=82 diazepam online] [http://library.cshl.edu/wp/vb/member.php?u=1380 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=163 cheap adipex] [http://students.hsc.unt.edu/housing/item.cfm?type=2859 cheap meridia] [http://news.engin.brown.edu/forums/thread-view.asp?tid=209 samsung ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=170 cingular ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=78 clomid online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30298 lisinopril online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=74 carisoprodol online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=352 cheap paxil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=227 free ericsson ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1386 free mono ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=69 albuterol online] [http://wc1.worldcrossing.com/WebX/.1de60a12 free ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=171 ambien online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=188 levitra online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=83 didrex online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30358 free midi ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2879 clomid online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=186 lipitor online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=215 free sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=346 meridia online] [http://students.hsc.unt.edu/housing/item.cfm?type=2923 sony ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30237 valium online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=171 cheap clomid] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=184 hoodia] [http://wc1.worldcrossing.com/WebX/.1de60a1b free music ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30264 but hydrocodone] [http://wc1.worldcrossing.com/WebX/.1de609db but adipex] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30321 cheap hgh] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=90 hgh online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30263 levitra online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=133 free tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=226 sony ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=117 propecia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=165 cheap vicodin] [http://library.cshl.edu/wp/vb/member.php?u=1340 soma online] [http://students.hsc.unt.edu/housing/item.cfm?type=2909 verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30252 buy meridia] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=221 vicodin online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30347 verizon ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1354 alprazolam online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30330 free nokia ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2903 qwest ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a26 sharp ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30348 free polyphonic ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=345 cheap viagra] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=239 cheap sildenafil] [http://students.hsc.unt.edu/housing/item.cfm?type=2876 didrex online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=142 wellbutrin] [http://students.hsc.unt.edu/housing/item.cfm?type=2872 cyclobenzaprine] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30333 funny ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a00 rivotril online] [http://library.cshl.edu/wp/vb/member.php?u=1356 paxil online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30357 free sharp ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=123 sagem ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30268 xenical online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=92 cheap hydrocodone] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=100 cheap lortab] [http://students.hsc.unt.edu/housing/item.cfm?type=2850 order phentermine] [http://students.hsc.unt.edu/housing/item.cfm?type=2869 cheap lorazepam] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=116 polyphonic ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1361 cheap xenical] [http://library.cshl.edu/wp/vb/member.php?u=1362 buy wellbutrin] [http://wc1.worldcrossing.com/WebX/.1de60a2b cheap ultracet] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=113 cheap paxil] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30279 cheap ultracet] [http://news.engin.brown.edu/forums/thread-view.asp?tid=229 free jazz ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2863 buy alprazolam] [http://wc1.worldcrossing.com/WebX/.1de609f4 mono ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1353 vicodin online] [http://students.hsc.unt.edu/housing/item.cfm?type=2880 albuterol online] [http://wc1.worldcrossing.com/WebX/.1de609eb funny ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=181 free ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2887 pharmacy online online] [http://library.cshl.edu/wp/vb/member.php?u=1364 cheap nexium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=222 cheap vigrx] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=166 buy ativan] [http://library.cshl.edu/wp/vb/member.php?u=1381 free polyphonic ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=180 flexeril] [http://wc1.worldcrossing.com/WebX/.1de609fd punk ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=102 free midi ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a2c ultram] [http://students.hsc.unt.edu/housing/item.cfm?type=2853 fioricet online] [http://students.hsc.unt.edu/housing/item.cfm?type=2899 tracfone ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=185 hydrocodone online] [http://library.cshl.edu/wp/vb/member.php?u=1378 free sprint ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1350 meridia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=152 valium online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=208 cheap phentermine] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=349 vicodin online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=77 free cingular ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0c wellbutrin online] [http://students.hsc.unt.edu/housing/item.cfm?type=2860 adipex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=223 free midi ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=126 sildenafil online] [http://library.cshl.edu/wp/vb/member.php?u=1383 free sagem ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=197 flexeril online] [http://students.hsc.unt.edu/housing/item.cfm?type=2898 free ringtones] [http://wc1.worldcrossing.com/WebX/.1de609ff real ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30336 qwest ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=343 online cialis] [http://students.hsc.unt.edu/housing/item.cfm?type=2924 ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=183 albuterol online] [http://library.cshl.edu/wp/vb/member.php?u=1342 cheap phentermine] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=220 free real ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2883 cheap lipitor] [http://news.engin.brown.edu/forums/thread-view.asp?tid=203 funny ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=73 ativan online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=218 free qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=202 tracfone ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=96 cheap levitra] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=105 free mp3 ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1375 free real ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30238 cheap phentermine] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30355 free punk ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30349 cingular ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=199 free music ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2914 free sony ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e7 diazepam online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30315 lortab online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=143 wwe ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2906 samsung ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=174 cyclobenzaprine online] [http://wc1.worldcrossing.com/WebX/.1de60a03 free sony ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2857 cheap ativan] [http://wc1.worldcrossing.com/WebX/.1de60a2d cheap valium] [http://students.hsc.unt.edu/housing/item.cfm?type=2856 cheap cialis] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30242 cheap fioricet] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=160 adipex online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=232 sony ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2900 funny ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2870 cheap xenical] [http://news.engin.brown.edu/forums/thread-view.asp?tid=150 cheap tramadol] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30332 tracfone ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30354 alltel ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=202 nokia ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=134 tramadol online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=167 cheap carisoprodol] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30269 cheap wellbutrin] [http://students.hsc.unt.edu/housing/item.cfm?type=2893 hgh online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=219 viagra online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30240 carisoprodol online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30316 order vigrx] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30351 free sonyericsson ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30350 sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=332 order tramadol] [http://students.hsc.unt.edu/housing/item.cfm?type=2925 mtv ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2915 mono ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30359 wwe ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2849 valium] [http://students.hsc.unt.edu/housing/item.cfm?type=2867 hydrocodone online] [http://wc1.worldcrossing.com/WebX/.1de60a16 levitra online] [http://library.cshl.edu/wp/vb/member.php?u=1379 music ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2919 free sharp ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30338 motorola ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=174 cheap wellbutrin] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=84 diethylpropion online] [http://students.hsc.unt.edu/housing/item.cfm?type=2882 zoloft online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=217 punk ringtones] ==Introduction==
+
==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.
 
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.
  

Revision as of 09:13, 18 July 2007

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 (i.e. preference settings, color values, etc.), stop, follow the vague memory of this sentence back to this page, and check out this userdata method.

When NOT to use it

If your plugin needs to insert multiple records or rows of something --- like coupon codes, guestbook entries, etc. --- you probably still want to create a dedicated table for that. The userdata functions are not meant for that.

Why it's useful

  • Fewer lines of code
  • Fewer keystrokes per line (no mysql query strings to write)
  • No worrying about creating a separate db in the install manifest.
  • Plugin userdata automatically uninstalled by product, no need to account for it in install manifest

How to use it

new

The basic idea here is to stick this line at the top of any script that uses the get() and set() functions. Replace "myplugin" with the name of your plugin folder. The other methods depend on this being set. If you don't do this first and try to call get() or set() php will bomb a fatal error.

$myplugin = new userdata("myplugin");

set()

Updates value of specific field (or inserts as new rec if fieldname not found)

$myplugin->set("firstname", "mike");

get()

Syntax
$myplugin->get([fieldname])
If $fieldname is NOT passed - Gets all userdata related to passed plugin and returns it in an array
If $fieldname IS passed - Gets data for requested field and returns it

Example #1: Get data from specific field.

echo $myplugin->get("firstname");

Example #2: Get all userdata stored for your plugin in an associative array (indexed by fieldname). Think of this as doing a mysql_fetch_array() on that one-row table you were going to create before discovering this userdata stuff.

$myprefsArray = $myplugin->get();

Bringing it all together

In this example, each available function is used.

$myplugin = new userdata("myplugin");

$myplugin->set("firstname", "John");
$myplugin->set("lastname", "Smith");

// This outputs "John Smith"
echo $myplugin->get("firstname")." ".$myplugin->get("lastname");

// This also outputs "John Smith"
$myData = get();
echo $myData['firstname']." ".$myData['lastname'];

Setting default values

Let's say you're using the userdata functions to store color values that you then retrieve in a template include to colorize certain template elements accordingly. Without setting any default values, the template will likely have a bunch of un-colored parts that should have colors (think transparent backgrounds where a solid bg color is expected) --- which may look a bit screwy --- until the user goes in to your config form and actually sets some values for those colors. This is where defaults come in handy. Here's how you can do them...

Example #1 - Setting a default background color of "#cccccc" (light gray) for an html element that you're outputting with a php template include.

<?
# Gotta do this first before you try to store/retrieve any of your data
# You can think of it like setting the "mode" to "working data related to your plugin specifically"
$mycolors = new userdata('myplugin');

# If no value exists, set the default
if ( $mycolors->get("headerbg") == "" ) {
   $mycolors->set("headerbg", "cccccc");
}
?>

<div id="header" style="background-color: #<? echo $mycolors->get("headerbg"); ?>;">
 This is my header
</div>
Personal tools