Drupal tutorials

How to enable user profile in Drupal 7

Sending
User Rating 5 (1 vote)

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 đŸ˜€

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:
[vim]
mkdir profile_unlock
cd profile_unlock/
vi profile_unlock.info
[/vim]

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

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

[vim]
<?php
function profile_unlock_system_info_alter(&$info, $file, $type) {
  if ($type == 'module' && $file->name == 'profile') {
    $info['hidden'] = FALSE;
  }
}
?>
[/vim]

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 https://www.aliencoders.org/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

Share your Thoughts