Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Last updated June 7, 2017

Use hooks to update the database tables and alter form elements.

Objectives and Prerequisites

You will need the following knowledge and skills. If you need a review, check out the Resources section at the bottom of this page.

  1. Analyze wireframes and construct a workflow to achieve the objectives.
  2. Use hooks to work with the database.
  3. Alter an existing form.

Wireframe Reference

You will need to refer to the wireframe collection PDF.

Tasks

Analyze the User Profile view and edit pages of the wireframes, and write pseudocode to illustrate how you could meet the requirements of both screens.

Create a function which creates a table to store the required information about a user.

Alter the user form to add the necessary fields.

Summary

  • Always have a clear idea of how a problem can be solved before beginning development
  • Additional tables can be created through hook_schema.
  • Forms can be altered to add additional fields.

Resources

Creative Commons License

Drupal Training Resources by Damian Robinson are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.damianrobinson.co.uk.