I have 2 profile2 types (and two common user roles) - "employer" and "applicant". I have "field_company_name" in "profile_employer" and "field_real_name" in "profile_applicant". I want to show field_company_name instead of username for employers and field_real_name for applicants (and "Editor" string for admins). How can I do that?


You can show an alternative name using the Real Name module.

However, you can't show one field for employers and a different field for applicants with Real Name out of the box.

What I would do is reuse the field_real_name in profile_employer and change the label to the company name; this will allow you to use field_real_name as a token for both employers and applicants.

In Drupal, you generally want to reuse fields across content types instead of making new fields if the uses are similar. Doing so makes it much easier to use modules like Real Name, Views, and Rules to manage your entire site.

  • I am idiot. Of course, real_name is the answer. And it supports tokens, so I just can use construction like [user:profile-employer:company-name][user:profile-applicant:real-name] - one of these fields should be empty if other is filled, and it means I have what I need. Oct 9 '17 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.