Last updated January 18, 2014. Created by mr.baileys on December 26, 2002.
Edited by iantresman, HongPong, LeeHunter, bekasu. Log in to edit this page.

The core Profile module (enable in admin/build/modules) allows users to share information about themselves through the use of forms that you can configure. Users can change their information by clicking the Edit tab of their "My Account" page. Profile information can be displayed to other site users.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

Is there a way that I can make a profile field editable only by admin?

I want to have a "member since" field for a membership program, but a lot of our users don't activate their accounts for weeks or months after they signed up for the membership. I want the user to see the field parsed on the user page, but I want to disable the user's ability to change that field. I could change permissions so the user can't edit any "profile" fields, but then they can't edit parts of their profile that I want them to have access to.

I hope this makes sense. Please let me know if you need more info.

You might find that the profile_permission module meets your needs.

Thanks for the suggestion. However, I am already using that module. What I need is to have the field be editable only by admin but viewable on the user profile. Unfortunately that module makes it so that field doesn't show up on their profile. I'm at a loss...

If you're fond of coding, you could do something like our solution to modify the profile template to just print the field instead of the form element. I haven't tried, but I think you might be able to use hook_form_alter to set the field properties to disabled. It would be nice to have a read-only option in the permissions.

We added something similar to this in the template:

        <div class="field_name"><?php echo $account->profile_givenname." ".$account->profile_surname; ?></div>
        <div class="field_team">Email: <a href="mailto:<?php echo $account->mail; ?>"><?php echo $account->mail; ?></a></div>
        <div class="field_team">Team: <?php print check_plain($account->profile_role); ?></div>
        <div class="field_memberSince">Member Since: <?php echo $account->content['summary']['member_for']['#value']; ?></div>
        <div class="field_location">Location: <?php echo check_plain($account->profile_location);?></div>

Version 6.x-1.2 now separates 'view' and 'edit' permissions for each protected fields.

Have you found any easy solution?

Count me in as needing this feature also. Not only do I need "member since", but I also need the following fields in the "Club Information" page settings:
- Club Affiliation (which club?)
- Club Title (chair, admin, member, etc.)
- Club Standing (active, on-leave, etc.)
- Club Accolades (past status)

A nice feature in addition to this is viewable by:
- just the user
- by same Club members
- by all
Sort of similar to UNIX permissions (user, group, world), throw in R or W access, and maybe an ACL here and there. That would make me a happy camper :-).

Looking into upgrading to 7.0 soon.

function MyMODULE_form_alter(&$form, $form_state) {

if($form['#form_id']=='user_profile_form') {
$form['field_MYFIELD']['und']['0']['value']['#attributes']['disabled'] = true;
}
}

would this be OK? or will I need to check on save too?

A user just found the solution as shown on this thread: http://drupal.org/node/1367008 The answer is the Field Permissions Module: http://drupal.org/project/field_permissions

I liked using this module as it helped me customize the user registration by adding fields. When I checked the output, it was all alphabetical and I couldn't see anywhere any presets to override it. Also, when I tried to fill out the 'explanation' part, instead of showing on top, it showed at the bottom of the field. Any help with any of those issues will be very helpful. Thank you.

Souleye

souleye

A workaround I've used for now regarding the alphabetical ordering is adding a number before the category titles (e.g. 1. Personal Information).

When adding new profile fields there is a entry possible to give a title to a page that is the result of a 'browse by fields' function. This would be great. Apparently as I create custome user profile fields and I can also provide the option to search for user profiles based on those fields.

Ok, I have set up several fields to 'browse by' but I am having trouble finding any documentation or way to 'browse by' the field. Where do I go in my Drupal application to use this feature? It is not on the search user form.

Thanks for any help.

Anyone who gives another a cold cup of water certainly will not lose his reward!

Hi there,
I am working on this feature as well, so if I understand you correctly what you are looking for is after you do a search on profile (built-in search or advanced search will not search profiles, you will have to download profileplus module http://mybesinformatik.com/profileplus) to search for profile, after the search returns the results, you will find your 'browse by fields' highlighted click on it to browse for other profiles that matches this resulted keywords.

How can you provide options to search for user profiles based on profile fields in your search or advanced search module?

Dunn.

Turns out that the Drual built in searchby user profile fields is not done via an advanced search form, like the advanced node search form. Instead when browsing user profiles at www.yourdrupalsite.com/profile the user profile field values for each user that are enabled for searching are hyperlinked to a page listing all the users with the same field value. This is useful, but not as useful as an advanced search form would be. I would have to browse my whole user list to find the links for all the possible values!

Anyone who gives another a cold cup of water certainly will not lose his reward!

Hello,

Before anything, I'm really new to Drupal and not fluent in english ;-)

I've created a new field type: selectionDB, that list values from the db (users list in my case).

Here is my code (in profile.module):

case 'selectionDB':
$result=db_query($field->options);
   $uArray=array();
while ($row = db_fetch_array($result)) {
$uArray[]=$row['the_label'];
   }
        $options = $field->required ? array() : array('--');
$field->options=implode("\n",$uArray);
   $lines = split("[\n\r]", implode("\n\r",$uArray));
        foreach ($lines as $line) {
          if ($line = trim($line)) {
            $options[$line] = $line;
          }
        }
        $fields[$category][$field->name] = array('#type' => 'select',
          '#title' => check_plain($field->title),
          '#default_value' => isset($edit[$field->name]) ? $edit[$field->name] : '',
          '#options' => $options,
          '#description' => _profile_form_explanation($field),
          '#required' => $field->required,
        );
      break;

Where query is filled in place of the 'option list' textarea.

That works great (the users are listed in edit mode), but ...

...here is my issue:

The other following fields are not displayed anymore.

Does anybody have an idea about this issue?

Thanks a lot for helping me.

I also had the same problem . I found alternate solution. I made changes in profile.admin.inc
profile_field_form_submit . Just before submit i am adding these values into the profile value.

looks like you cannot safely order profile fields if you have more than 21.

Anyone who gives another a cold cup of water certainly will not lose his reward!

when you click "edit" on a user profile page??

i see in my page.tpl.php there is a $tabs2 variable being echoed-- but the 10 custom profile fields i added are not showing up on the edit page.

They are there during signup and the variables are in the array to be displayed on the front end--

just not in the edit page..

help.

thanks

I find that when I add a custom field to a form with CCK, whether its a user profile or not, it has neither view nor edit permissions for any user role. When I set the permissions the fields then show up in the necessary pages.

I just ran into this myself, and the solution is almost embarrassingly easy.

After you create the custom profile fields, you have to assign them to roles. On the Profile field edit screen, you'll see a tab at the top that says "Roles". Click that, and use that page to assign your custom profile fields to appropriate roles.

Then, the next step is that the individual users must have the roles to which the fields have been assigned.

Once these 2 conditions have been met, you'll see the custom profile fields on the user edit screen.

- Alan Tutt

Exceptional Personal Development for Exceptional People
http://www.PowerKeysPub.com

Very helpful, thanks Alan.
I presume this is only for D6 as I don't see a Roles tab on the Profile field edit screen in D7.
However, there are some visibility settings on the same page that assign levels of privacy.
I wish I'd know about the profile setting earlier as I had earlier setup the fields in user settings!

regards

Dave Sandilands
http://dsnet.info

Hey,

how do i create different profiles for each role i have?

I need to get N different roles, and each one should have differente mandatory fields in their profiles. Is there any especial module or feature for this?

Hi,

This can be solved by using profile permission module.

http://drupal.org/project/profile_permission.

You can restrict the profile field for N different roles.

Is it possible to add a number field to the user profile form?

subscribe

Hi,

I don't have a clue of what's going on, but I suddenly can't create nor edit profile fields. I've uninstalled almost all user-related modules (ex. hierarchical select & user taxonomy), but I still can't make any change.

Does anyone get an idea ?

Greg

If you can't solve it use Content Profile Module http://drupal.org/project/content_profile

Thank you for the help. Shortly after i posted my comment, i did more searching for answers and found this... http://drupal.org/node/917038

I had just installed the Profile Picture earlier in that day, and that was what broke the functionality.

Fixed now.

Roger Goode | Artist/Designer | Hillsborough, NH

Is it fixed with the new release of Drupal : 6.20 ?

Otherwise, there is the patched given by this link (which I found following the above link) : http://drupal.org/node/917396

Greg

During registration I am using hook_user with $op of 'insert'. I am checking the mail address and password (I added a field to the form) with a remote server to obtain a membership number.

I read that during 'insert' I could update the account object like this and it would be stored.

$account->status='1';
$account->profile_mymodule_membership=$response['MembershipNumber'];

I was setting status to make the user active without waiting for admin. ( I want validated users to be active at once, but non-validated to wait for admin). The status seems to set for a moment but is not saved.

I was hoping to save the membership number on a profile field. I created that field manually using the profile functions.

Anyone know what I am missing?

Dave Roberts

Not that the documenation of hook_user() is clear, but it seems that rather than updating the account object, the $edit array is key. The profile code scans that array and stores the information. $account is not used.

Dave Roberts

I am trying to add fields with identical names. How do i add titles that are the same withought getting a "The specified title is already in use." error?

How can I add some custom text to each profile category (as in an explanation of what the form is for)?

Thanks.

Hello guys. I am developing a custom module that include a custom field that has to be added through the profile module.
I am using the form that the profile module uses to add new custom fields to create a custom $form_state with all the fields necessary to add the new field and going with drupal_execute("profile_field_form", $form_state).
Problem is that i get this error when i am trying to let this work while i am installing the module (obviously as this piece of code is inside the .install module as it builds all the "environment" to make use of the module, i test it uninstalling and reinstalling the module)

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'profile_field_form' was given in /home/gothatway/work/htdocs/DrupalBook/includes/form.inc on line 378.

Why i posted here is because i realize that in the module section, my module, doesn't show the dependencie with profile even if i set it up on the .info file

dependencie[] = profile

Is this a problem regarding this or it is just that i did something wrong in my code?

Thanks. :)

Gaining experience day by day!

Francesco Vanacore - Junior PHP/Drupal Developer
www.francescovanacore.com - Looking for interesting project or works! Contact me if you are in need!

dependencie[] = profile is wrong

it should be

dependencies[] = profile

I created custom fields that can be filled in to display on the my account page

http://nyc.thedelimagazine.com/user

but there is no way to fill out the fields or view. all that displays is.

History Member for 23 hours 14 min

the feilds are all public here
admin/user/profile/edit/6

and the permissions are set so that an authenticated user can view them. I also made the block visible on the left nav bar. do i have to edit the user-profile.tpl, all that is in that file is

<?php
print $user_profile;
?>

The user can fill out "my account" fields on registration because I enabled that. After which the feilds are no longer editable.

Did you ever figure out why this is happening? I am having the same issue in D7.

--kavita

I am using the profile fields in registration for firstname and lastname. Is it possible to restrict the characters?
I want to avoid that a user registers e.g. with a firstname like <a%20href="javascript:alert('BANG')">BANG</a> which is possible.
Can this become a potential danger / security risk for the site?

I know when I use the content_profile module there are options to configure the allowed values, is there a way to do this here too?

Hello, I have posted this already in several places, but no-one seems to know or be interested.

How to generate a blank first field in the dropdown selections for profile so people are really forced to make a selection at signup: for country, gender and date of birth.
I tried with , - select an option -, --- and "|" (which, by some post, seems to work in CCK but not in profile, couldn't confirm it though). In all of these case it just turns into a (weird) additional option.

So if people should choose from the typical counrry listing of "Afghanistan, Albania, Algeria...." . In gender people should choose between "male or female" and in Date of birth they should indicate dd/mm/YY.

However, since there is no blank field option for either of these dropdowns, it is not possible to make it required (first option always chosen) so if people pay no attention and don't select, they all turn into males from Afghanistan who were born today.

Do we all have to draw the conclusion that this essential, standard procedure (99,99% of social webs) cannot be done in Drupal??? Either with the CORE user-profile module or any other module (at least content-profile doesn't work either)???

http://drupal.org/node/118544
http://drupal.org/node/182946

I started with Drupal in 2007 and then my life got stuck...

I added custom fields to the user profile but when the user goes back to edit them, they do not show up. Any ideas??

Hi, I would like to make feature on my site:
When logged in user click external link new window opens and he is already logged in to other website, (username and pass are the same as on my druppal 7 site) or username and pass are prepopulated with data and all he has to do is click on login button there.
I dont know how to bite this problem. Is there module to do that, shall I tweak link's url with token(if yes - how, link would be field in Views) or shall I try to do it with javascript(if yes -how)?
I would be grateful for suggestions or ridirection to some info.

Sorry if I'm posting it in wrong place

way to go - this is wanted & needed by many alll round the globe.

keep up the great project

i love drupal for its power and its great options to extend. unleash the power of your web-project with drupal! The system with many thousands extensions - see all the great things get your module, plugin or whatever you need. All the best to your endeavo

Thanks a lot for the info given and for the scripts. Now many things are much clearer for me as a beginner in the field! Glad to have come this post in the web.
scrabble helper tool

Is there any integration of the profiles module with the user points module in drupal 6? I am make it so a user gains points when a certain profile fields are filled out.

I want to build a drupal 7 website which has user membership area, while users are registering they have to make payment through paypal and after purchasing or paying( maybe using paypal buy button and redirect them to successful purchase page) I want them to receive 'profile compete' message on their profile.( How to add payment option to Profile2 module?)
Using ubercart I think is too huge for small site like this, is there any way or any module that when users register and make successful payment 'Completion process' or 'profile completed' appear on their profile, or those user just registered and didn’t pay they receive message on their profile that profile is not complete and after paying through paypal automatically their profile become completed for a specified time period or at once???