Skip to main content

How to enable user profile in Drupal 7

Sanjeev Kumar Jaiswal's picture

If you are making a website using Drupal 6.x (I am using Drupal 6.24), then you can add/edit/delete user profile settings very easily by accessing this link: http://your-site-name/admin/user/profile

But, the Profile module is deprecated in Drupal 7, because it is already integrated to Drupal 7. Although, it is still there in hidden mode to provide an upgrade path for Drupal 6 sites that used it or if you are still living in Drupal 6.x world

In Drupal 7 you can find inbuilt profile module under: http://your-site-name/admin/config/people/accounts/fields
But, I assure you it will confuse you more (at least I got confused and didn’t had courage to experiment on it) and you will not be able to add your personal and professionals tab etc :D

How we can enable Drupal 6 compatible profile module which is hidden by default in Drupal 7?
Since the Profile module is deprecated and included with Drupal 7 for legacy reasons only, you should avoid using it though. The module is hidden by default, except for sites using the Profile module that were upgraded from an earlier version.

Let’s create one simple module, and enable it with sufficient permission to desired user roles.
Starting in your Drupal site's sites/default/modules directory:

  1.  
  2. mkdir profile_unlock
  3. cd profile_unlock/
  4. vi <strong>profile_unlock.info</strong>
  5.  


Then, be in insert mode, which you can do by pressing i keyword then copy and paste below lines.
  1.  
  2. name = Profile Unlock
  3. description = Unlock the core Profile module.
  4. core = 7.x
  5. files[] = profile_unlock.module
  6.  


Then save it and exit from vim  by using escape key (esc) and then :wq
Now, Again open vim/vi editor and copy paste below lines after being in insert mode.

vi profile_unlock.module

  1.  
  2. <?php
  3. function profile_unlock_system_info_alter(&$info, $file, $type) {
  4. if ($type == 'module' && $file->name == 'profile') {
  5. $info['hidden'] = FALSE;
  6. }
  7. }
  8. ?>
  9.  


then save it and exit from vim  by using escape key (esc) and then :wq

Now Enable this module

1.    Navigate to the Modules page (Admin->Modules). i.e http://www.aliencoders.com/admin/build/modules/list
2.    Enable the checkbox beside the Profile Unlock (same name that you used in profile_unlock.info script under name = xxx) module.
3.    Click Save configuration. (It will not alter any Database columns/tables, so no need to run update module which usually we run after every new module installation)

Profile module will now be enabled, and you can disable and uninstall Profile Unlock and remove the profile_unlock module folder.
You can extend Drupal 7(or Drupal 6) Profile module i.e user profiles by adding an unlimited number of extra fields.

How Can I add a field to user profiles?
Suppose, you want to add another tab as professional and under which you wish to add custom field likes present company, expertise, designation etc. Then just follow these 4 simple steps!

1.    Navigate to the Profiles page Administer-> Configuration -> People -> Profiles  in Drupal 7 and admin->user->profile for Drupal 6 users.
2.    In the Add new field section, click a field type i.e. checkbox, url, data, list, text etc
3.    Then, enter the required information and configure all the desired options according to your need. Category like personal or professional is required, field name and form name are three mandatory fields.
You can also check visibility options using radio button and check boxes.
4.    Finally, Click Save field.

Comment/feedback are much awaited!
 
Source: Drupal.org

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.