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

crea’s picture

Title: different confirmation text per relationship types » Relationship types should have individual texts with Token replacements.
Category: support » feature

Yes, 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.

crea’s picture

Seems like a fix should go into user_relationships_ui_get_message() function. It would also require a switch from variable storage to table storage.

Bilmar’s picture

+1 subscribing

crea’s picture

Title: Relationship messages should be alterable per relationship type » Relationship types should have individual texts with Token replacements.

Another 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.

crea’s picture

Title: Relationship types should have individual texts with Token replacements. » Relationship messages should be alterable per relationship type
crea’s picture

Title: Relationship types should have individual texts with Token replacements. » Relationship messages should be alterable per relationship type

Hmmm, %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.

crea’s picture

If 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 ?

YK85’s picture

+1 subscribing

crea’s picture

Title: Relationship messages should be alterable per relationship type » Relationship strings should be alterable depending on relationship

Basically, 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.

alex.k’s picture

It 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.

crea’s picture

Yes 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.

robby.smith’s picture

I 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.

rburgundy’s picture

+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

crea’s picture

I 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 ;)

rburgundy’s picture

dang, 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!

robby.smith’s picture

kindly bumping

graper’s picture

I 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

alex.k’s picture

Status: Active » Closed (won't fix)

@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.

wickedskaman’s picture