The drupal_alter() in realname_update() does not pass arguments by reference, and thus, the hook_realname_alter/patter_alter simply don't work. The attached patch fixes this problem. Tested manualy on my local dev.

CommentFileSizeAuthor
realname_alter.patch976 bytesmariusz.slonina

Comments

Status: Needs review » Needs work

The last submitted patch, realname_alter.patch, failed testing.

dave reid’s picture

Status: Needs work » Closed (works as designed)

Nope this is incorrect (see the note section on http://php.net/manual/en/language.references.pass.php). It is the responsibility of the hook to have its parameter referenced just like all other alter hooks in Drupal - the exception being if the parameter is an object, which is has a reference to the object passed by default as of PHP 5. But the $realname parameter is not an object - it's a string.

function mymodule_realname_alter(&$realname, $account) {
  $realname = 'changed!';
}
mariusz.slonina’s picture

Thanks, you're right, I wasn't aware of that, anyway it seems I had some weird caching problem or so, but it works now :)