Hello,

I have custom account profile fields added at admin/config/people/accounts/fields

First Name - field_firstname - Text field
Last Name - field_lastname - Text field

Then as part of a content type, I added the two fields to the content type from the existing fields list. For the default value in these fields, I used

First Name - field_firstname - Text field / Default Value: [current-user:field_firstname]
Last Name - field_lastname - Text field / Default Value: [current-user:field_lastname]

When I go to add new content to the content type, the First and Last Name fields are blank. This tells me that at least a token replace is trying to work, as it isn't just the token showing up as the default value. Any ideas or thoughts on this?

Image #3 is the 'add new content' form.

This behavior is present in both current releases. As a proof of concept test, [current-user:uid] did work correctly. The form fields were populated with my UID's.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewbe121212’s picture

drewbe121212’s picture

Issue summary: View changes
drewbe121212’s picture

Issue summary: View changes
maximpodorov’s picture

Do you really have this field for the current user (and it's not empty)? Could you try [current-user:field-lastname] instead of [current-user:field_lastname]?

drewbe121212’s picture

Hi maximpodorov,

I can confirm that the user I am currently logged in has the first name and last name fields filled out.

Using [current-user:field-lastname] did not work.

drewbe121212’s picture

Pafla’s picture

I made a field in profil (Role) as text type
And choosed "[user:roles]" as default
and saved other is default

But when i go to user/1/edit-profile and users/bruger - the field is empty or hidden

Did i do anything wrong or?

Pafla

maximpodorov’s picture

[roles] value is array. What do you expect to see?

Pafla’s picture

FileSize
70.6 KB

I expect to see "The user roles associated with the user account."

Or does it not work with all token in that list?

See screenshot

maximpodorov’s picture

You can't see arrays. Could you try another token: [user:roles:first] instead?

Pafla’s picture

When using [user:roles:first] it is still empty.

And when i try to use another token from another field in the profile, it is empty too

drewbe121212’s picture

I can also see the token roles replacement if I use the one that implodes the roles [current-user:roles:?] (or something similar, can't remember at the moment).

This seems to be affecting only custom profile fields, but not fields that are provided by the default install.

MrPeanut’s picture

For what it's worth, custom profile fields are working for me (with the exception of #2212445: How to set taxonomy term reference field). I have set a custom token from my user profile ([current-user:field_location]) as the default value for the body and it does show up.

maximpodorov’s picture

Status: Active » Closed (works as designed)

So no evident bug exists here.