[ewiki] Re: lib/uservars_pages.php
- From: Mario Salzer <mario@xxxxxxxxxxxxx>
- To: ewiki@xxxxxxxxxxxxx
- Date: Thu, 08 Apr 2004 23:05:53 +0200
I think two of the virtual uservars plugin[] hooks are redundant:
- clear_uservar
- 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.)
Reducing the number of required hooks, would ease implementation of
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).
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.
Andy, would you also rename the plugin hooks to just ["uservar_get"]
and "_set" ? - there's two times "var" in it ;)
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
- References:
- [ewiki] lib/uservars_pages.php
- From: Andy Fundinger
Other related posts:
- » [ewiki] lib/uservars_pages.php
- » [ewiki] Re: lib/uservars_pages.php
- » [ewiki] Re: lib/uservars_pages.php
- [ewiki] lib/uservars_pages.php
- From: Andy Fundinger