There are some issues where the real name is not updated when saving/updating a profile2 profile.
Since profile2 has it's own update hook, wouldn't it make sense to implement the profile2 update hook within the realname module like this:

/**
 * Implements hook_profile2_update().
 */
function realname_profile2_update($profile) {
  $account = user_load($profile->uid);
  if (is_object($account)) {
    realname_update($account);
  }
}
CommentFileSizeAuthor
#3 2303599_3.patch504 bytesnancydru

Comments

hass’s picture

Status: Active » Closed (duplicate)

There is a duplicate in profile module queue.

nancydru’s picture

Status: Closed (duplicate) » Active

IMHO, this belongs in the RealName module, not in Profile2. Just like we implement hook_user_update(), we should implement this hook as well.

nancydru’s picture

Status: Active » Needs review
StatusFileSize
new504 bytes

Here it is as a patch.

nancydru’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

donquixote’s picture

I had this problem on user registration, with a registration form that also creates the profile.
The realname token is using a property defined in a custom module.

I needed to implement hook_user_profile2_insert(), and within this hook implementation, call drupal_static_reset('profile2_load_by_user'), before calling realname_update(). Did all this in a custom module, now it works.

hass’s picture

Related issues:

Please share your patch with a test in the case #1044130: Real name not computed when profile field is shown on registration page and we can get this fixed.

hass’s picture

Related issues: