Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Howdy-
I use two different relationship types: (1) coworker (two way), and (2) blacklist (one way)
"Are you sure you want to become johndoe's blacklist?"
"Are you sure you want to become johndoe's coworker?"
As you can see the phrase above doesn't work for terms such as blacklist, wishlist etc. but works great for coworker, friend etc.
I was wondering how much flexibility we have in changing the text and if it can be customized for each relationship type.
ie "Do you want to add johndoe to your blacklist?" [SEND] and "Do you want to ask johndoe to confirm if you are coworkers?" [SEND]
Comments
Comment #1
crea CreditAttribution: crea commentedYes, this is missing feature. I want to make something like "contact list", so messages would be like "Add Joe to contact list" and/or "Let Joe to add you to his contact list".
Because there is single text with replacement pattern containing relationship name, it's not possible (without hacking t() function which most drupalers avoid).
I suggest adding individual texts and integrate this feature with Token module. Also this is not only about confirmation texts.
Comment #2
crea CreditAttribution: crea commentedSeems like a fix should go into user_relationships_ui_get_message() function. It would also require a switch from variable storage to table storage.
Comment #3
Bilmar CreditAttribution: Bilmar commented+1 subscribing
Comment #4
crea CreditAttribution: crea commentedAnother idea: instead of over-complicating this, first refactor the module so messages are loaded as $relationship object properties. Then any message modification can happen inside hook_user_relationships('load', $relationship, 'type') given that module performing the modification has bigger weight. I would prefer this way so I could supply my own messages quickly without writing monster of code.
Let's hear maintainer opinion on this first.
Comment #5
crea CreditAttribution: crea commentedComment #6
crea CreditAttribution: crea commentedHmmm, %relationship_plural_name is also ugly. In many languages e.g. in Russian there are several plural forms. There's format_plural() function in Drupal to deal with that.
Comment #7
crea CreditAttribution: crea commentedIf we load relationship messages in hook_user_relationships('load'), then what do we have to do with additional replacements passed to user_relationships_ui_get_message() function ?? These replacements are not available during relationship load, and they simply make no sense when you can just provide final string in relationship object.
If we remove these additional replacenents, I'm not aware if there could be modules that pass replacements to the user_relationships_ui_get_message() function that could become broken ?
Comment #8
YK85 CreditAttribution: YK85 commented+1 subscribing
Comment #9
crea CreditAttribution: crea commentedBasically, to support custom strings, we need to:
1) display customized strings in links/buttons/whatever invokes action
2) display customized strings in forms.
3) display customized strings in messages.
4) display customized strings in notifications if they are different from messages.
Comment #10
alex.k CreditAttribution: alex.k commentedIt seems we just need to let admins enter all the message strings per relationship type. Which will also take care of all the different language specific cases that don't happen in English.
Comment #11
crea CreditAttribution: crea commentedYes for example how it's done you can look at the Flag module. I hoped for something simple like drupal_alter() but there are too many hardcoded strings (most importantly, in different places) and this is not simple either :-/ So implementing relationship string selection could be on par with string altering in terms of amount of work.
Comment #12
robby.smith CreditAttribution: robby.smith commentedI have used Flag Module below and the interface to change messages per type was very easy to use.
It would be awesome to have this feature in User Relationships.
Comment #13
rburgundy CreditAttribution: rburgundy commented+1 subscribing
@crea - would you be able to develop a patch to add this functionality to UR? or someone else in the community?
Thank you
Comment #14
crea CreditAttribution: crea commentedI decided to use Flag Friend module because I already use Flag module and like it very much. I am now refactoring 2.x branch so that it will support arbitrary relationships via different flags. Thus it's unlike that I will work on patch to UR ;)
Comment #15
rburgundy CreditAttribution: rburgundy commenteddang, it would have been awesome to have your support on this =)
I hope someone else with programming skills will be able to help with a patch that will allow this very useful functionality in User Relationships.
Thanks!
Comment #16
robby.smith CreditAttribution: robby.smith commentedkindly bumping
Comment #17
graper CreditAttribution: graper commentedI think this would be something very good for the UR module. I want to change the "order" of the grammar logic of a relationship so that instead of becoming someone's child I become their parent. This helps in building a hierarchy type set of relationships.
Much of the wording used implies child relationships like "become users's child" where as I want it to say "make user my child" This order change also works for other relationships.
examples.
Dealer => become someone's dealer (while it works, not compatible with other's below)
Sales Rep => become someone's sales rep (if I'm the dealer, I can't make someone my sales rep, they have to make the relationship to me)
Technician => become someone's technician (again I am the manager, and I can make myself thier manager, but I can't make them my technician)
this feature request would work great in conjunction with the Invite module where I can invite someone as a sales rep for me while I may have been invited as a dealer/reseller to the company.
Granville
Comment #18
alex.k CreditAttribution: alex.k commented@graper I agree but someone would have to provide a solid patch implementing this. So, i will mark it as won't fix until then.
Comment #19
wickedskaman CreditAttribution: wickedskaman commentedTry this: http://drupal.org/project/stringoverrides