Hi there, thanks for making such a wonderful module.

I'm running Activity with Buddylist, and while the activity feed handles friend adding and removing just fine, there's a bug with the actual initial friend request. When I ask a user to be my buddy, Activity creates a new entry. However this entry is blank. In the section where I'm supposed to add tokens for buddylist activities, there's no slot for giving tokens to the actual friend request.

So it seems like we need to add "friend request" to the list of activities covered by the buddylist addon. How do I do this? I've looked at the file a bit and I'm not seeing any obvious way to add another activity, token slot etc. to it.

Help? I'd rather not have a crap load of blank messages for all the friend requests.

Comments

sirkitree’s picture

what version of buddylist are you using?

bflora’s picture

5.x-1.1-beta is the version I'm using.

sirkitree’s picture

Priority: Critical » Normal
Status: Active » Needs review

This was actually fairly easy. Here's how I went about it.

First we have to see what all hooks buddylist makes available, or what all actions it reports. So for this I simple grepped the buddylist.module for module_invoke. Each one of these calls lists a specific action, for instance, module_invoke_all('buddylist', 'add', $requester_account, $requestee_account, false); tells other modules that buddylist has performed and 'add' action. So searching through the module I found module_invoke_all('buddylist', 'request', $user_to_add, $user, false); which is the announcement from buddylist that a request has been performed. I then just add this into buddylistactivity.module in the list of 'ops' as this diff will show you.

Index: buddylistactivity.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/activity/contrib/buddylistactivity/buddylistactivity.module,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 buddylistactivity.module
--- buddylistactivity.module	19 Mar 2008 17:47:46 -0000	1.1.2.6
+++ buddylistactivity.module	28 Sep 2008 20:50:40 -0000
@@ -8,7 +8,7 @@
  */
 function buddylistactivity_activity_info() {
   return array(
-    'ops' => array('add' => t('Add'), 'remove' => t('Remove')),
+    'ops' => array('add' => t('Add'), 'remove' => t('Remove'), 'request' => t('Request'), 'cancel' => t('Cancel'), 'deny' => t('Deny')),
     'types' => array('buddylist' => t('Buddylist')),
     'roles' => array(
       'author' => array(
jaydub’s picture

The newer versions of Activity shouldn't write empty records like these
as there are tests for whether the relevant token type and operation type
are enabled now before writing a record. But while I am looking at this, it
looks like we can add in hooks to the additional buddylist operations including
'request', 'deny' and 'cancel'.

jaydub’s picture

I committed an update to buddylistactivity so that the additional
operations are exposed to activity.

jaydub’s picture

So now the buddylist activity module has hooks for these
buddy operations:

add a buddy
remove a buddy
request to add someone as your buddy
deny a request to be added as someone's buddy
cancel your request to add someone as your buddy

See #314433: Activity 6.1 & 5.4 for more details on our new development
branch and help us by testing out a snapshot.

sirkitree’s picture

Status: Needs review » Closed (fixed)