[ic] Re: Setting price_level in userdb

John Young interchange-users@icdevgroup.org
Fri May 23 16:40:01 2003


Jamie Neil asked:

> Short of resorting to the data tag, can anyone tell me how to set the
> price_level field in UserDB when I create a new user?
> 
> I've tried creating a value called price_level before I call userdb with the
> new_account method, but although this works for username, fname, lname etc.
> I can't get it to work for price_level. I've also tried using save and
> set_preferences, with a value and scratch value, but nothing seems to work.
[detail deleted]

Not sure if I understand your question completely, but you might
want to look at Section 8 of icdatabase.txt (and perhaps some of
icupgrade.txt) (I bet you already have, since you seem knowledgeable
about this stuff).  For instance, using the info in 8.6, you could add:

UserDB default preferences "somevar someothervar price_level"
         (be sure to include vars like "email" if you use them)

to catalog.cfg.

Then, if you have already established Values->{price_level}, such as
[value name=price_level set=somevalue hide=1], it should be saved
when you call [userdb function=save].  You can call [userdb function=save]
after a successful [userdb function=new_account], as w/mv_check=New_account:

[set New_account]
     [if type=explicit compare="[userdb function=new_account"]
         [userdb function=save]
         mv_nextpage=welcomepage
     [else]
         mv_nextpage=new_account
     [/else]
     [/if]
[/set]

I found the source for UserDB.pm a big help in understanding things
a little better.

I imagine the veterans have better ways of doing the above, but
perhaps this will help you.

John Young