This topic is locked

Help with registration

3/15/2007 10:19:09 PM
PHPRunner General questions
E
evan_ad2000 author

Hi,
I am having some problems trying to figure out how to get this to work. I have a table (_user) that consists of the attributes (user_id, username, password, group_type). When a new user registers, they only have to choose a username and password. I would like to set a default group_type when they register. How can I do this?
Thanks,

Evan

J
Jane 3/16/2007

Evan,
you can do it using AfterSuccessfulRegistration event on the Events tab. Here is a sample:

function AfterSuccessfulRegistration()

{

global $values,$conn;

$strUpdate = "update _user set group_type='default value' where username='".$values["username"]."' and password='".$values["password"]."'";

db_exec($strUpdate,$conn);

echo $strUpdate;

}

T
thesofa 3/16/2007

Might it not be easier to set a default value in the MYSQL table definition for that field, less code?

B
Blooper 9/20/2007

Evan,

you can do it using AfterSuccessfulRegistration event on the Events tab. Here is a sample:


Good day.

I feel a bit imbarresed for posting this here, but I'm haing a bit of trouble I'm trying to do the same thing, but not having much luck.

I keep on getting can not find field this or that or sometimes just an plain SQL does not work with your code thing.
My table is called Models

my field is called group_id

I would like to add the deafult "model" to the field group_id where the setting is stored for the group id.

my username filesd is called "userid" and my password is called "password"
Please could U help. I'm starting to give up hope.
Thanks.

Alexey admin 9/20/2007

Hi,
just add the following code to Before registration event.

$userdata["group_id"]="model";



The code would work with PHPRunner 4.1

B
Blooper 9/21/2007

Hi,

just add the following code to Before registration event.
The code would work with PHPRunner 4.1


Hello again... I thought I had 4.1, but now I see I only got 4.0. build 265 <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=21565&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
Is there any way I can do the same in 4.0 <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=21565&image=2&table=forumreplies' class='bbc_emoticon' alt=':o' />
Thanks for replying.

J
Jane 9/24/2007

Hi,
this code will work in the PHPRunner 4.0.