Posts

Showing posts from September, 2015

How to add extra fields to user profile in Drupal?

Step 1. - Create custom module -For Example My custom module name is extra_user_profile
Folder Name - extra_user_profile
Files - extra_user_profile.nfo, extra_user_profile.module, extra_user_profile.install
Step 2. extra_user_profile.nfo file:- name = Extra User Profile description = Add new field in user profile core = 7.x version = "7.x-2.5" core = "7.x"
Step 3. extra_user_profile.module file:- <?php
Step 4. extra_user_profile.install file:- <?php
/**  * Implementation of hook_enable().  */ function extra_user_profile_enable() {   // Check if our field is not already created.   if (!field_info_field('field_nickname')) {     $field = array(         'field_name' => 'field_nickname',          'type' => 'text',      );     field_create_field($field);
    // Create the instance on the bundle.     $instance = array(         'field_name' => 'field_nickname',          'entity_type' => 'user&#…