I am using profile2 module for user profiles and created a profile with first name and last name fields which are used for configuring real name. And I have set real name as page title. But there is machine name being displayed if the first name and last name fields are empty. I want to set user name to the first name field until the profile fields are filled. is there anyone who knows the solution?

1 Answer 1


use form alter for alter profile2 fields name, then put pass uid load user using userload function get username put this value as default value for the first name field in your profile 2 form ..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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