Add custom fields to the user registration form

sak

Joined: 2008-06-24
Posts: 5
Posted: Tue, 2008-06-24 15:58

Hi,

Hoping someone here has tried or wanted to do this before... I need to add a few extra fields to the user registration page... i.e., telephone number, mobile, DOB, etc

Any insight would be greatly appreciated :)

Cheers,
Simon

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-06-24 22:03

I remember a thread on this recently - I think someone came up with a UserInfo module to do it - it's in the community repository, if I remember correctly.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2008-06-24 23:42

http://gallery.menalto.com/node/69763
It needs a codex page I think. ( takers? )

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Wed, 2008-06-25 07:49

dave,
can you please create a skeleton codex page ? (do not know how to do it)
I will fill up the details ....

serbanc - www.e-poze.ro

 
sak

Joined: 2008-06-24
Posts: 5
Posted: Wed, 2008-06-25 08:38

Hi guys- and thanks for your speedy responses. I have installed the userdata plugin written by serbanc (good work BTW) - wasn't exactly what I was looking for...this plugin assumes users will fill in their user profile info.

Is there any way I could add these extra fields to the actual new user registration form? There are certain fields I want to make *required upon registration.

Again any help would be appreciated :)

Thanks
Simon

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-06-25 08:48

Yes no doubt you could. Do you have an intermediate level of expertise in programming? Do you have the time to learn the Gallery framework and module structure? You'll need to start by getting to grips with both of those. Also the Smarty templating system.

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Wed, 2008-06-25 09:03

dear all,
Definitely you could add those fields to the registration module.

However, in order to be fully added to registration, also the users module has to be modified to "receive" the supplementary info.
This requires changes to the core files, so, unless the core team of gallery does not decide to incorporate those changes, you can be in the situation that you cannot upgrade due to such changes.

At least that was my logic for developing a module and not patch the existing ones.

serbanc - www.e-poze.ro

 
sak

Joined: 2008-06-24
Posts: 5
Posted: Wed, 2008-06-25 09:07

Hi alecmyers,

Yes to all three with the possibility of a little guidance :) I think I have a handle on the templating system... well a beginners handle.

!. So I guess I start with adding the new fields in the UserSelfRegistration.tpl loacted in the register plugin...
2. edit database
3. look into editing the user module in admin...

Anything I have missed?

Thanks mate
Simon

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Wed, 2008-06-25 09:27

In fact,
If you decide to keep the UserData module and you do not have a problem to have a manual dependency between the UserRegistration module and UserData module, you can do:
1. keep the UserData module as is.
2. copy/modify the UserData.inc/.tpl into the UserSelfRegistration.inc/.tpl

serbanc - www.e-poze.ro

 
sak

Joined: 2008-06-24
Posts: 5
Posted: Wed, 2008-06-25 10:10

Hi serbanc,

That sounds very promising... I just tried a quick test... not sure if I am missing something.

I copied and pasted all the code from the userData.inc into the UserSelfRegistration.inc file. I then obviously replaced the previous version of the UserSelfRegistration.inc in the modules folder within the register folder.

I tested the registration form and the newly created userData fields didn't appear...

Cheers,
Simon

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-06-25 10:19

Simon,

My approach would be to 1) add the fields to the UserSelfRegistration template 2) modify the template's controller to save the extra fields, but into the same tables as Serbanc's userdata module 3) modify the view to load the data back into the template

In 2) that avoids you having either to manually extend your database tables or to extend the table schema in the core modules and reinstall the relevant modules to cause the tables with the new schema to be created.
In 1) it may not just be a case of copy/paste - you need to make sure the form field names don't clash, and check carefully that your modifications in 2) and 3) mesh with the existing code.

You'll have to keep careful records of your modifications, because every time you upgrade the UserSelfRegistration module you'll have to rework the changes.

You can put your modified template files in a local/ directory, and keep the originals intact - but .inc and .class files need to be changed in-situ.

Good luck!

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Wed, 2008-06-25 11:52

yeap, alecmyers is right!
a copy ALL definitely would not work!
you have to integrate into the view and controller classes.

serbanc - www.e-poze.ro

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-06-25 15:10
serbanc wrote:
dave,
can you please create a skeleton codex page ? (do not know how to do it)
I will fill up the details ....

Done:
http://codex.gallery2.org/Gallery2:Modules:userdata

Thanks for the contribution.

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
m3lvm

Joined: 2009-06-17
Posts: 49
Posted: Thu, 2009-06-18 18:45

Great Module
I noticed that you can create just about anything with this.
What would be an advantage is an aditional eliment that allow a user to define which group they wish to be registered to EG standard regesterd user or photographer. this would allow multiple regestraiton types without admin adding members to these groups.
Also it would be great to have group dependant fields extra info for photographers...
I am not a hard coder at the mo still learning...

 
jyacks

Joined: 2009-06-24
Posts: 1
Posted: Wed, 2009-06-24 14:27

I am a newbie to gallery.
I am trying to make heads or tails out of the post above.
Is there anyway, someone can give a step by step walk through (including files names) on how to intergrate the userData module into the register page?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2009-06-24 23:48
Quote:
someone can give a step by step walk through (including files names) on how to intergrate the userData module into the register page?

The codex page does not give details? What steps are you having trouble with?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team