Comments

Berdir’s picture

Title: Integration with User relationships » Send private message to all friends
Project: Privatemsg » User Relationships
Version: » 6.x-1.x-dev
Status: Active » Postponed

Would be great to have some integration with User relationships..

UR does already have integration with Privatemsg for some things like only allowing to write messages to friends...

...and to have an option e.g. to send message to all my friends

This is a different issue however, and depends on #555016: Planning for sending messages to roles.. Once that feature is commited, it should be quite easy to write a patch for UR to include this. I will do that if I find the time.

Changing title, project and setting to postponed on the above issue.

YK85’s picture

+1 subscribing

richtalbot’s picture

Hi,

This really would be a great additional plug-in to UR.

What would be good is to have is the ability to allow users to inform a selection of their connections (friends) about a new Node.

eg.
Step 1) Create a node
Step 2) Click button labelled 'Tell your connections about this NodeName'.
Step 3) Select from selectbox (eg. control+click) which connections you want to inform
Step 4) Write personal message to go with the e-mail. Press a 'Send' button.
Step 5) E-mail goes to all selected connections, with details and URL of the Node, and the personal message.

Any chance of this kind of functionality being created?

Keep up the good work, Alex! UR is a great module.

Rich Talbot

richtalbot’s picture

Alex or Berdir

We are happy to provide financial compensation if you complete a plug-in which carries out the steps I've outlined about for UserRelationships, and bring this task to the top of your to-do list.

You can get in contact with me at {work AT 9clients.com} to discuss this.

Regards, Rich Talbot

Berdir’s picture

Status: Postponed » Needs review

Warning: This is the very first release and nothing more than a proof-of-concept. Do not use on a production site

Ok, as promised, here is a first version of the user_relationship_privatemsg module, which allows to send messages to all relationships.

- Obviously, this needs the latest patch at #555016: Planning for sending messages to roles.
- I just tried it with a simple (two-way) relationship with a single entry and it seemed to work

I will enable this on my test site soon too....

Berdir’s picture

Ups, this time with attachment...

BenK’s picture

Subscribing... Also wondering if the same approach in #6 can be taken with Flag Friend module (http://drupal.org/project/flag_friend) for similar functionality. We use both User Relationships or Flag Friend, choosing between them based on project requirements.

Cheers,
Ben

Berdir’s picture

Sure, someone just needs to write an integration module for Flag friend, similiar to the one I posted in #6. Basically, that means taking that one and porting the queries to flag friend. The two main design goals of #555016: Planning for sending messages to roles. are scalability/performance and supporting all kinds of recipient types.

There are still obvious bugs in the module in #6. For example, right now, when answering to a message sent to all friends, it would be sent to *your* friends. Correct would be that you are not allowed to write the friends of the original author. I just did it to test the other patch (make sure that it works for other recipient types than roles)

But once a there is a working version, you're welcome to port it to flag friend, it is not very complicated.

Bilmar’s picture

First testing and feedback. Please feel free to just jump down to My Expect Flow for my feedback.
Thanks for the fast development!

Relationships
Admin (Richard Cypher): Sascha Grossenbacher, Kahlan Amnell, Zeddicus Zu'l Zorander, Cara
User1 (Kahlan Amnell): Richard Cypher
User2 (Zeddicus Zu'l Zorander): Richard Cypher
Disabled (Cara): Richard Cypher

Flow of testing
1. User2 sends message to recipient: Friends [relationship]
result: only Admin receives this message

2. Admin replies to the message
Recipients: Friends [relationship], Zeddicus Zu'l Zorander
- User2 receives reply with original subject, original message and reply message of Admin
- User1 and Disabled receive message with original subject but only reply message of Admin (no original message included. Also I didn't check Sascha Grossenbacher as I don't have login info but expecting same result.)
- Sascha Grossenbacher and Cara are not shown as participants in the reply message

3. User1 then replies to the message
- User2 and Admin receives the reply of User1
- Disabled does not receive the message (!)

As users reply to the thread, their names were added to the participants list:
User 2 sends first message - Participants: Friends [relationship], Zeddicus Zu'l Zorander
Admin replies - Participants: Friends [relationship], Richard Cypher and Zeddicus Zu'l Zorander
User1 replies - Participants: Friends [relationship], Richard Cypher, Kahlan Amnell and Zeddicus Zu'l Zorander
Sascha Grossenbacher and Cara were never added as they did not send a message (is this correct? Cara is also disabled so not able to send message but is able to receive)

My Expected Fow
1. User1 sends to recipient: Friends [relationship].
2. Admin receives message
3. Admin replies to message
4. Only User1 and those users within User1's Friends [relationship] should receive this reply

For example, if User1 has relationships with Admin, B, and C and Admin has relationships with User1, E and F. If User1 sends to Friends [relationship], then Admin, B and C will receive this message. If Admin replies to this message, then User1, B and C should receive this (current testing shows that User1, E and F will receive Admin's reply). If there is a method in the future to add more participants to a thread, Admin would be able to add his/her Friends [relationship] list to the thread and the message will be sent to E and F as well.

I hope my testing and feedback will come in handy in any way =)

Berdir’s picture

Thanks for testing....

- Users that have disabled privatemsg should not receive private messages, this is a bug

- As I said, this is only a proof of concept, a relationship recipient does not behave as expected (always and only include the friends of the original author)

Bilmar’s picture

cool, yea I definitely understand
just wanted to report back with testing of current state =)
really appreciate the hard work!

Berdir’s picture

Ok, here's an update.

- There is a new table which combines author/relationship so that we can use a single identifier for the recipient. If you had this installed previously for testing, you need to uninstall and install again, there is no upgrade path.

- Fixed many bugs, added many tests and also switched to use the UR api where possible.

BenK’s picture

Berdir, great work on this. Just did a quick test of the http://test.worldempire.ch site (which includes the patch in #12) and things look good. Here are a couple of small issues I noticed:

A. If a user doesn't have any Friends, he can still send to his list of "Friends." Probably, either the "Friends" relationship should be hidden for a user without any friends, or else an error message should be displayed saying that he doesn't yet have any friends to send the message to. Also, for sites with multiple relationship types (say, "Friends" and "Secret Pals") does user_relationship_privatemsg only show relationship types that the user has permission to make? Either "Secret Pals" could be hidden based on this permission or else it could be hidden because the user doesn't have any "Secret Pals."

B. If a message is sent to a user's "Friends" and "Friends (relationship)" is displayed as a recipient, then "Friends (relationship) should link to a user's list of Friends at /relationships/[relationshipid]. This will make it easier to see everyone who received a message.

Thoughts?

Cheers,
Ben

rafinskipg’s picture

I don't know how to make it work...

I had the module enabled, but nothing seems to be new in the private messages. I don't see a "check" field or something like that...

What I'm doing wrong? :S
I have to aply the patch? Where?

Thanks

Berdir’s picture

You should be able to insert the name of the relationship into the To: field. Since there is now also support to have links to pre-fill the To: field with other values than users, suggestions are welcome on where to place a "Send message to related users" or something like that.

EndEd’s picture

Subscribing

imDhaval’s picture

love to join

Ela’s picture

subscribing

chuckbar77’s picture

subscribe

BenK’s picture

Bumping this so that I don't lose track of it...

BenK’s picture

I plan to start working on this soon.

BenK’s picture

Status: Needs review » Needs work

@Berdir: Do you think we should continue to work on this in 6.x or should we first get it implemented in 7.x and then backport?

--Ben

Berdir’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
9.42 KB
4.71 KB

Yes, this will go into 7.x first.

Here is a new patch:

- Port of the 6.x version above
- Removed all privatemsg related parts from user_relationships_api and user_relationships_ui and moved them into this module.
- Added support for 'offset' option to user_relationships_load()
- Removed some bogus code from user_relationships_api.module.

Note that you need to apply the patch *and* the tar.gz this time. CVS is fooling with me once again. I so can't wait for git...

BenK’s picture

Status: Needs review » Needs work

I've started testing of the latest patch (and new sub-module).

One initial observation: I've noticed that if "Allow sending messages to all users, but provide users with an option to only receive messages from their confirmed relationships" is selected, those settings are now missing from the account edit page.

--Ben

Berdir’s picture

Status: Needs work » Needs review
FileSize
28.11 KB

New patch, yay for git!

Two hook implementations were using a wrong module name, it should work now.

Berdir’s picture

FileSize
31.39 KB

That patch missed a removed file, this one should be complete.

For testers: If you get a fatal error after applying the patch, try visiting update.php to clear the cache.

nikkubhai’s picture

FileSize
96.86 KB

I applied the patch . But when I enabled privatemsg integration, a page full of code appears and then the actual page starts. See the attachment.
I am not sure whether there is a problem with the patch. This was the first time I applied patch so I may have done it wrong.

Berdir’s picture

How did you apply the patch? I hope you didn't do it by hand (because that would take forever for a patch of that size)

I can't reproduce that using "git apply < privatemsg_refactoring.patch".

Make sure the file user_relationship_privatemsg/user_relationship_privatemsg.module starts with "<?php" on the first line.

nikkubhai’s picture

FileSize
30.07 KB
41.01 KB

Ignore the previous comment , I guess it was my mistake in applying patch.

I did it again. This is the procedure I followed.

1. downloaded the user_relationship_privatemsg.tar.gz file and extracted it in user_relationships folder

2. Downloaded patch in the user_relationships folder

3. Applied patch using command patch < my.patch in cygwin
( I renamed the patch file to my.patch. I ensured that I was in the user_relationships folder in cygwin.
I got a message " can't find file to patch at input line 587. Perhaps you should have used the -p or --strip option?
Other messages were of patching file.)

4. Please see the screenshots. The 1st one is when I write a new message. The second one is of user edit page.

Berdir’s picture

Try "patch -p1 < my.patch", or apply the patch with "git apply" which defaults to that option, if you have git installed.

nikkubhai’s picture

The command "patch -p1 < my.patch" doesn't work. after applying at each step it says, file is missing. and if we still patch, it leads to several errors.

Is there any problem with the line 587? because with patch < my.patch all other files are patched except that it can't find file to patch at input line 587.

Berdir’s picture

patch -p1 is correct, but your step 1 is unecessary. You do not need to download the tar.gz, that is an old version. Just download the most recent patch and apply that.

nikkubhai’s picture

FileSize
54.9 KB

Aah!
I applied the patch again. This time the procedure was correct. I also ran update.php.

I got this error when I clicked on run cron.
"Fatal error: Call to undefined function user_relationships_types_load() in C:\wamp\www\drupal\sites\all\modules\user_relationships\user_relationship_blocks\user_relationship_blocks.module on line 281"

Also see the screenshot . This error was on all pages.

Berdir’s picture

Ok, that part has to wait until we move the api module around, it's too fragile to do right now. Try the updated patch. Remember to get a fresh copy of user_relationships before applying the patch again (Git makes this easy!)

Berdir’s picture

Wrong patch, try this one.

BenK’s picture

Status: Needs review » Needs work

Hey Berdir,

I've just completed some testing of the latest patch (in #35). It's working pretty well, but here are some thoughts:

1) Are you sure that we should call the sub-module "Privatemsg integration"? How about "UR-Private Message Integration" like the other sub-modules? The reason I ask is that it took me a little while to find the "Privatemsg integration" permissions on the permissions page (because they weren't listed with the other UR sub-module permissions.

2) Sending to a relationship type is working fine. But replying to that message seems to be a problem. Even when the recipient should have permission to reply, the following message is being printed instead:

You can not reply to this conversation because all recipients are blocked.

BenK does not have an established relationship with you.
Editor does not have an established relationship with you.

Note that the message in this example was sent by BenK to Editor. Editor does, in fact, have an established relationship with BenK. And Editor, naturally, does not have an established relationship with himself. This seems to be a problem when "Only allow sending messages between confirmed relationships" is selected as configuration setting.

3) The autocomplete for relationship types might be too permissive. For instance, if you type in the letter "d", then the "friend" relationship type will show up because it has a "d" in the word.

4) Should there be a different permission on the permissions page for sending to each relationship type? That would be very handy. For instance, in many use cases, we may want to allow sending a user's "friends" but not to our default administrative relationship type.

5) Currently, we don't have any differentiation between the direction of one-way relationships that are allowed to be reciprocal. For instance, if userA is a "fan" of userB (which doesn't require approval), then both userA and userB will be allowed to send messages to each other. But we may only want to send a message to "fan (Them to You)" but not "fan (You to Them)". So should the direction of one-way relationships be specified in the autocomplete?

6) In the autocomplete, there's no real way to differentiate between which name is a user, relationship type, role, or organic group. Is there any way to make this more clear (either with a label or default CSS-based color coding)?

7) When you select "friends" in the "To" auto-complete I don't think it's totally clear that you're about to send this message to all of your friends. Is there any way to make this more clear (such as showing the number of recipients)? For instance, could it show in the autocomplete as "My friends (408 recipients)" or something like that? Maybe we could do this for roles and organic groups, too? I looked at how Facebook does it and it shows a certain number of individual recipients below the list name when sending to a list.

8) The "View relationship recipients" permission does not seem to be totally working properly. Even a user who has this permission sees the message as being between individual users. For a permissioned user, perhaps it should say something like: "Between you, BenK, and BenK's friends." And should be "BenK's friends" be a link to BenK's friend relationship list page?

9) Is there any easy way to make an alternative to the autocomplete for selecting lists of users? I could envision the autocomplete used for sending to individual users and a separate dropdown menu (which automatically populates the autocomplete field) used to select lists of users (such as relationship types, roles, and organic groups). Instructions could say "Enter individual users (separated by commas) or else select an available user list from the dropdown menu."

Thoughts? I'm just trying to address some usability stuff here, but I realize that we don't want to delay committing the patch by making things too complex to code. So let me know if there are some simple ways to address some of the above to-do items without having to kill any kittens in the code.

Cheers,
Ben

nikkubhai’s picture

Status: Needs work » Needs review
FileSize
54.1 KB
95.89 KB
6.53 KB

Now I was unable to even install the modules.
I even tried on new drupal test site. Its not working.
Below are the errors.

Can't we leave this feature and go ahead with other ones?

BenK’s picture

Status: Needs review » Needs work

I am not seeing any of the errors reported by nikkubhai. The patch applies fine for me and I'm not getting any error messages.

--Ben

Berdir’s picture

@nikkubhai: You seem to have a permission problem now, the webserver can't open the files that you changed.

nikkubhai’s picture

Since BenK applied the patch and didn't find any problem, I guess it should be commmited.
Btw, how do I get rid of permission problems?

Berdir’s picture

1) I actually don't really like the UR prefix, but I *do* like consistency. Changed ;)

2) Weird. There was actually no code to check *if* they actually have a relationships. If the setting to block if they don't was enabled, they were just always blocked :p Not idea where and when exactly that part of the code was deleted. Anyway, it should work now. Also added a check to allow writing to yourself ;)

3) Changed, it should only show those which start with the search string and it should be case insensitive now, just like user search.

4) Yeah, possibly. Can we do that as a follow-up? See #870126: permissions for each role for the corresponding issue for roles...

5) Yeah, it probably should. But, how? Depending on what the relationship means, both could actually be possible, no? Sounds like we want to add some settings to the relationship type form to configure it. But same here, probably a follow-up thing...

6) Well, it was your idea to only show the type when there is a conflict :p but yeah, I agree, it is bad currently. I've seen that te-brian has a very nifty autocomplete on his big site, we want something similar. This is something that Privatemsg needs to support before we can implement it here, so again, follow-up, depending on a privatemsg issue (I *think* there is one open about that, actually..)

7) Yes, what Facebook is doing here is pretty cool. But again, the ability to do that needs to be implemented in Privatemsg first.

8) It is working for me now, can you try again. Also made the text link to the relationships page but it is somewhat pointless because right now, you can only see that with the administer user relationships permission. Remember our discussion about that ;)

9) #563424: To: dropdown is the issue you want for that. And no, it's not yet working like that. But if you help test it, we can probably get it to that point and push it in 6.x-2.x (and 7.x-2.x once created).

Here is a new patch.

PS: Yay, reviews! ;)

Berdir’s picture

Status: Needs work » Needs review
BenK’s picture

Status: Needs review » Needs work

Hey Berdir,

I tested the latest patch and it's working very well. #1, 2, 3, and 8 are all fixed. And I can create separate follow-up issues for #4, 5, 6, 7, and 9. So the only new things I noticed are:

10) I'd probably remove the word "(relationship)" from various strings. I think this word is kind of confusing to the end-user without the proper context. So for instance....

a. Change string: "A message has been sent to Your friends (relationship)." To this: "A message has been sent to your friends." Note that I also removed the capital "Y" on "Your" (which looks better, I think).

b. Change string: "Between you, BenK and friends of BenK (relationship)". To this: "Between you, BenK and friends of BenK"

c. Change string: "Between you, Ed Editor, person1 and Your friends (relationship)". To this: "Between you, Ed Editor, person1 and your friends". Note that the capital "Y" has been changed to lowercase on "your".

11) I wanted to confirm that the following is the desired behavior: Currently, only the sender sees replies from everyone in a message sent to the sender's friends. So if the sender has two friends (user1 and user2) and sends a message to his friends, then user1 cannot see replies from user2 (and user2 cannot see replies from user1). Only the sender can see replies from both user1 and user2. This seems to be the case regardless of whether user1 and user2 are friends or not. Is this the desired behavior? Should it be? Note that I've been testing this with the "Only allow sending messages between confirmed relationships." option selected.

So that's it for me. This is pretty much RTBC and if you'd like to go ahead and commit (possibly making the above string changes) that's fine with me.

--Ben

Berdir’s picture

Status: Needs work » Needs review
FileSize
32.22 KB

10) I can do both (remove (relationships) and change Y to y), the only problem is that can only do it always or never. Removed for now, we'll see how that works.

11) Yes, that is right now the desired behavior. We could think about adding another permission that would basically allow to *reply* to the friends of sender (not write them new messages). But again, that is a bit complicated because user_relationships_privatemsg doesn't know if it is for a reply or a new message when trying to check if you can write to a specific recipient (A "recipient" is always "all related users of type X of user Y").

One last round... :)

BenK’s picture

Status: Needs review » Reviewed & tested by the community

Latest patch works great... this is RTBC!

--Ben

P.S. Just a reminder to also commit the "your friends" link change that we also discussed in IRC.

Berdir’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

I actually commited this yesterday.

Back to 6.x-1.x...

csyoung’s picture

Please tell me how I add this functionality to my site. I have upgraded to UR 6.x-1.x-dev (2011-Feb-25) hoping it was there but it doesn't work for me. Do I need to download anything else or run a patch (patches)?
Thank you.

mrf’s picture

Status: Patch (to be ported) » Needs review
Issue tags: +Novice
FileSize
23.5 KB

Here is a half-hearted attempt at porting this to 6. Still definitely needs some work but doesn't seem too daunting.

mrf’s picture

Status: Needs review » Needs work

Above patch has a couple fatal errors in its test file, unsurprisingly since that didn't get touched when I ported it.

mahi.orai’s picture

Title: Send private message to all friends » Send message to all friends of newly user
Project: User Relationships » User Relationships Generate
Version: 6.x-1.x-dev »
Component: Code » Miscellaneous
Assigned: Unassigned » mahi.orai
Category: feature » task
Priority: Normal » Major
Status: Needs work » Active

i want to send a message to all friend of newly user.
when a new user create his account then automatically a massage send all of his friend.
please tell me the solution of this issue in drupal module?

mrf’s picture

Title: Send message to all friends of newly user » Send private message to all friends
Project: User Relationships Generate » User Relationships
Version: » 6.x-1.x-dev
Assigned: mahi.orai » Unassigned
Category: task » feature
Priority: Major » Normal
Status: Active » Needs work

Please don't change the issue settings unless you have a good reason for doing so.

Kavita Thakur’s picture

Status: Needs work » Needs review
Issue tags: -Novice

#12: user_relationship_privatemsg.patch queued for re-testing.

ajayg’s picture

Issue summary: View changes

IS there someone who have actually used the latest patch? If yes, it makes easier to review and mark RTBC