[ic] Re: Your Interchange question

Jamie Neil jamie at versado.net
Tue Feb 24 12:06:07 EST 2004


tom friedel wrote:

> Hi,
> Sorry to bother you, I was about to post to the interchange list the 
> exact question you asked as I can not get the answer you received to 
> work.  Here would be my posting.  If you have any info you could share 
> with my I would appreciate it.
> thank you
> tom friedel
> 
> 
> I am trying to set the price_level field of the userdb MySQL table to
> a value of 'customer' when a new account is created.  I can easily set
> some fields in UserDB
> 
> [value name=lname set="FORCE"]
> [value name=price_level set="customer" ]
> [userdb save]
> 
> Will save just the lname to FORCE, but price_level does not get set.
> 
> 
> http://www.icdevgroup.org/pipermail/interchange-users/2003-May/033555.html
> 
> appears to answer the question, and says to put in catalog.cfg
> 
> UserDB default preferences "somevar someothervar price_level"
>         (be sure to include vars like "email" if you use them)
> 
> But this is not working for me (price_level not saved)

Hi Tom,

I seem to remember spending a couple of days on this without getting 
anywhere :(

I seem to have ended up doing it this way:

# Set values to be stored in userdb
$Tag->value( { name => email, set => $email, hide => 1 } );
$Tag->value( { name => fname, set => $fname, hide => 1 } );
$Tag->value( { name => lname, set => $lname, hide => 1 } );
# Try to add user
if ( $Tag->userdb ( { function => new_account,
         assign_username => 1,
         password => $password,
         verify => $password,
         profile => autocreate } ) ) {
# If user created ok then set price_level
         $Tag->data ( { table => userdb, field => price_level, key => 
$Session->{username},  value => "club_member" } );
         $Tag->data ( { table => userdb, field => account_id, key => 
$Session->{username},  value => $memberid } );
         Log("OK,Member added: username=$Session->{username}; 
memberid=$memberid");
         $Tag->userdb ( { function => logout } );
         return "OK\n";
}
else {
         Log("ERROR,Failed to add member to database: memberid=$memberid");
         return "User creation failed\n";
}

This could equally be done using IC Tags instead of perl (can't remember 
why I did it in perl now). Not very elegant, but I couldn't find another 
way to do it at the time.

-- 
Jamie Neil | <jamie at versado.net> | 0870 7777 454
Versado I.T. Services Ltd. | http://versado.net/ | 0845 450 1254


More information about the interchange-users mailing list