Limit activity by user relationship

msmccask - June 19, 2009 - 20:02
Project:Activity
Version:6.x-2.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Not sure I am right here, but looking at the tables that activity uses and fills, I am not sure that there can be any way to create a query which will bring back activity limited by people with whom you have a relationship (or any other user id filter/limit of any sort for that matter).

Although it SEEMS like joins on the activity, activity_message, activity_targets table, and whichever table has the user id you want to limit should work (joining activity.uid = sometable.uid), the activity.uid field might have 0 in it (for facebook style statuses - perhaps this module is broken and should be populating the uid column?). If you try to join on the activity_targets.uid column, the amid you get back in those rows correspond to rows for the author in the activity_messages table. Is facebook style statuses working correctly and this table structure is what y'all were after? If so, I don't see how you can do a limit by user id. What am I missing? Happy to help create a patch/look into facebook style statuses (might be easiest fix).

#1

Scott Reynolds - June 19, 2009 - 20:35
Status:active» postponed (maintainer needs more info)

It is simple enough. Goto admin/settings/activity/settings (i know bad url...) and enable what ever relationship manager you have under the Activity Access Control. Now this will only affect new activities as its just been turned on.

Any new activity will be generated with this relathionship magic attached to it. Then when you Create a View, you will see a filter Activity Access: Flag_friend and you can specify the relationships there.

Or out of the box, you can create a View, add a Filter that says "Activity Access: author" which will give you the activity messages you are the 'author' of.

Still working on getting a screen cast together for some of this stuff. I hope that helps.

If you tell me your "relationship" module I can give you more guidance.

#2

msmccask - June 19, 2009 - 21:44

Using user_relationships (UR). I don't see anything but "comment" under Activity Access Control. I have applied the UR patch (UR_2.patch) from another thread.

Also, the facebook statuses issue can be resolved by adding the line
global $user;
after line 412 in activity.module (function activity_record($object, $context) {). Seems that function did not know what $user was and the context object that facebook status provides doesn't have anything with a key of "facebook_status" (it does have an "owner" keyed field which has the the important info - but the line 500 $record->uid = (!empty($context[$type]->uid)) ? $context[$type]->uid : $user->uid; was creating nothing.

How do I get user relationships to show up as an item for Activity Access Control (if that's the problem I need to solve)?

Thanks!

#3

Scott Reynolds - June 19, 2009 - 22:04

The UR patch is behind on the API. It doesn't work yet.

cool find.

<?php
$record
->uid = (!empty($context[$type]->uid)) ? $context[$type]->uid : $GLOBALS['user']->uid;
?>

will be the fix.

#4

msmccask - June 19, 2009 - 22:20

Ah, ok. Well, if you give me a hint on where to root around, I could help with UR integration, but understand if you want to keep extra cooks out of the kitchen.

As it stands I probably don't need the UR restriction immediately - I can get by with a view showing all users activity for a couple weeks.

Thanks.

#5

Scott Reynolds - June 20, 2009 - 04:27

sure follow these instructions for flag friend. Its really the same. hook_activity_access_api() is gone, the realms property to the info object. Pretty straight forward change.

#6

Ken Hawkins - November 11, 2009 - 18:51
Status:postponed (maintainer needs more info)» closed

For those also looking to use User Relationships with the latest version of Activity, the latest RC of UR has re-linked the functionality.

Marking as closed.

#7

rjbrown99 - November 12, 2009 - 07:02

Nice - after an update to the latest Activity and UR -dev releases I visited /admin/settings/activity/settings and now have an option for User_relationships_api: friends (which is my relationship type.) I ticked the box and we'll see how it goes over the next few weeks. Thanks guys.

#8

deltab - November 25, 2009 - 12:01

+1

 
 

Drupal is a registered trademark of Dries Buytaert.