In this patch I adjusted the hook names to match the module name so they would be called. After I noticed how many time hook_username_alter was called, I commented that out and move the logic to hook_realname_alter and made the Realname module. Realname now handles caching the results after the first lookup so it is much more efficient. You probably wouldn't notice the performance difference on a single user profile, but when calling a View that lists hundreds of usernames looking the contact's display name up on every load is noticeable.
I can't include a module that doesn't have an official release. I am willing to help you co-maintain this if that's what it takes to get an official release.
Comments
Comment #1
kreynen commentedIn this patch I adjusted the hook names to match the module name so they would be called. After I noticed how many time hook_username_alter was called, I commented that out and move the logic to hook_realname_alter and made the Realname module. Realname now handles caching the results after the first lookup so it is much more efficient. You probably wouldn't notice the performance difference on a single user profile, but when calling a View that lists hundreds of usernames looking the contact's display name up on every load is noticeable.
Comment #2
pillarsdotnet commentedThanks; will review as soon as I can.
Comment #3
kreynen commentedAny updates on this?
We've deployed the patched version at https://www.channelaustin.org/
I recently created a minimized mirror of CiviCRM so it could be whitelisted and included in packaged install profiles on Drupal.org
#1588192: Please Whitelist this CiviCRM repo minimized to be < 10MB by removing libraries that can be shared from sites/all/libraries
Our goal is to include CiviCRM and several of the CiviCRM related modules that improve the integration in the Moderate level of the Community Media Starter Kit.
I can't include a module that doesn't have an official release. I am willing to help you co-maintain this if that's what it takes to get an official release.
Comment #4
pillarsdotnet commentedWill add you as co-maintainer asap.
Comment #5
pillarsdotnet commentedPatch applied to 7.x-1.0 release.