Hi,

I posted a similar issue before, but I think there are still some points where username should be themed. I attach a patch hoping that this helps identifying the remaining spots.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YK85’s picture

Status: Active » Needs review
ajayg’s picture

Status: Needs review » Needs work

1. I can understand the need to change "user_relationships_ui.actions.inc" But Why would you need to theme user name in a mail message (in user_relationship_mailer_defaults.inc)? Unless I am missing something here, what is the use case?

2. If you have answer to #1 above then there are few more changes needed. In the same function, $requester->realname,$requestee->realname,$relationship->deleted_by,$deleted_by->name also will need theming, correct?

advseb’s picture

Sorry for the late reply. Well, in a theme, you can overwrite the theming function of the username and for example replace it with values taken from the user's profile (like firstname + lastname). You want to include this also in an email so that it says "Dear Mr. Firstname Lastname" instead of "Dear username".

About your second question: Yes, it might be that there are more spots, but my patch is based on things we do on a production site and for the cases used there those customisations are sufficient.

ajayg’s picture

Advseb,
since the patch is for all users of user relationships module, any changes specific to your production enviroment only should not be there. If we agree there is a reason to theme username, we should theme other places as well. For those who don't need that theme, keep it as it is (don't override theming) to get the default behaviour. But We don't need another patch later when someone needs it. Let us do the complete job if we are patching.

advseb’s picture

Fully agree, I just provided the patch based on my production environment, because that is what I can test.

christianchristensen’s picture

I am curious if this is the right place...

We have a similar problem where the user_relationship is providing the user name in the Actions block (e.g. "Become 's Friend"). Specifically to our case we use the realname module to get a users name uniformly across the system. Looking at this block there is a quickfix to theme the username on this block (additionally I went ahead and passed some parameters that the realname module uses on hook_username). This fixes our case, but it doesn't seem to be a universal fix...and I am not quite sure that this is the correct approach to the patch (note: if you just use "theme('username', $user)' the result is something like: "Become [User Name]'s Friend").

Please see attached patch.

alex.k’s picture

The place is right except I would suggest that this override is implemented in your site's theme as opposed to patching the module... this will let it survive past module updates. Better yet, implement themename_user() so that things are uniform across the whole site. I still agree with the above - you can't please everyone with any given theming approach, so overrides are the way to go in my opinion.

Berdir’s picture

Additionally, the problem with the patch is that those options only have an effect when realname.module is installed, they are not supported by core. So for all users without that module, it would show up as a link.

alex.k’s picture

Category: bug » feature
Status: Needs work » Closed (won't fix)

Marking wontfix per above.

bdlangton’s picture

This patch can be ignored by the maintainers. I am just making an update to our patch above at #6, and our development process requires us to use drupal.org to put our patches and use in a makefile.