i am new in drupal so in drupal where coding is done i don't know. my query is After we add any field in user login or registration form, how to insert that field value in database ? for eg. drupal have 2 fields default (username and password) now in login form block i also add new field which is named as DateOfBirth. now how can i insert that value in database and also login user with the username and password and with DOB as well.

Comments

Divya Pandey’s picture

Hi,

I have researched and found out that, there are some methods to have solve your issue.

1) If you want to create a custom code for theme, then go to-> sites/all/themes/your_theme/template

Here you can write the custom code for theme or create your tpl File.

2) You can also create a custom module containing the functionalities, then go to -> sites/all/module/"Create a module"

Here you can create a custom module to give functionalities.

3) Also you can create a content type through your admin panel, go to-> structure/content type.

There you can make your fields to be added for your form which when made are automatically connected to your database.

4) To create or add a registration form you can add new fields from backend, then go to ->

admin/config/people/accounts/fields and can manage that field in database by admin panel

rahul_mishra’s picture

There is no need to code or worrying about database, this feature is already available in drupal and its contributed modules, they take care of the database itself.

you can go to Config > People > Account Settings > Manage Fields

Then, you can add fields to user profiles just as you would add fields to any content type. When you add fields here, there is a checkbox to "Display on user registration form" if you want the field to be part of the user's registration process.
Also there is a module available Profile 2 module, that is very useful to add extra fields to register form.

cilefen’s picture

Category: Task » Support request
Status: Active » Fixed

The question was asked more than 18 months ago.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Assigned: Deep1992 » Unassigned
Issue tags: -how to insert value in DB