[ewiki] Re: lib/uservars_pages.php

Apologies for the late reply, I took a vacation :-)  I'll probably submit
the noted changes on Monday.


> -----Original Message-----
> From: Mario Salzer [mailto:mario@xxxxxxxxxxxxx]
> Sent: Thursday, April 08, 2004 4:06 PM
> To: ewiki@xxxxxxxxxxxxx
> Subject: [ewiki] Re: lib/uservars_pages.php
> 
> I think two of the virtual uservars plugin[] hooks are redundant:
> - clear_uservar
I added this hook only because unset may not equal empty.  A flag could be
tracked by set and clear, or some systems may use a clear call to clean up
and remove storage.  Does any of that make it seem more useful to you?  If
not I'll take it out over time.

> - search_uservar
> could easily be provided by using the _set and _get functions instead.
> (The ewiki_search_uservar() and ewiki_clear_uservar() should stay for
> convinience but use _get and _set to accomplish tasks.)
Search is needed even though the current implementation of it is poor.  The
trick is that Search is a get across all users.  In a database-based
uservars system (I'll probably write/adopt one) the search would be very
different as it would query just the values table.  Also, search can
generate a user-list by searching for all users with "Real Name" set or
similar techniques.

> Reducing the number of required hooks, would ease implementation of
I could implement a generic get-based search, but how would it get a
user-list?

> actual userdata storage systems; which I find very interesting indeed,
> and is the major point where ewiki lacks behind others. Maybe we
> should even setup a plugins/user/ subdirectory for it (also if this was
> usually related or tied to the authentication system).
This implementation requires an authentication system but any system will
do, I agree that a plugins/user/ subdirectory is in order.  Should I put my
guis in there or somewhere else?  What about plugins requiring a uservars
system?  Can the main calls go to /lib/?

> Also I'd persoanlly prefer to use a EWIKI_USERVARS_PAGENAME_PREFIX
> of "system/user/" or so, as it was purely system data and did not take
> a WikiWord pagename usually.
Sounds good.

> Andy, would you also rename the plugin hooks to just ["uservar_get"]
> and "_set" ? - there's two times "var" in it ;)

duh, yeah, I'll put that on my todo list.

Andy

> mario
> 
> > I just commited a usable version of lib/uservars_pages, this plugin
> > allows you to store user data through 5 function calls that I hope to
> > see support other, similar functions the calls are:
> >
> > function ewiki_get_uservar($varname, $defaultValue=NULL, $username=NULL)
> > - returns value of uservariable $varname or $defaultValue if it is not
> > set.
> > function ewiki_set_uservar($varname, $value, $username=NULL)
> > - set value of uservariable $varname returns true on success
> > function ewiki_getall_uservar($username=NULL) - returns all
> > uservariables for a user as an array.
> > function ewiki_clear_uservar($varname, $username=NULL) - unsets value of
> > uservariable $varname returns true on success
> > function ewiki_search_uservar($varname, $value=NULL) - returns array of
> > $username => $value for users that have uservariable $varname set (and
> > equal to $value if $value is set)
> >
> > $username is optional in all calls defaulting to the current
> > $ewiki_auth_user.
> >
> > The uservars_pages implementation stores these variables on specially
> > named pages, it is not efficient (especially on searches) but it should
> > prove a good starting point.  I have some simple interfaces to release
> > and I should have some plugins based on these calls soon.
> >
> > Andy
> 
> 
> 
> _________________________________________________
> Scanned on 08 Apr 2004 21:23:16
> Scanning by http://erado.com

Other related posts: