In my current project I need to be able to record when a user requests someone to be a buddy, and when they get approved (or not).

Is there anyway I can do this without hacking?

(I probably already know the answer to this but I thought I'd check.)

Steve

Comments

dldege’s picture

Steve,

This patch, http://drupal.org/node/121054, waiting to be committed as soon as I get some feedback that its working OK is exactly what you need. It adds a module hook for all of those actions and it would be trivial to make a simple logging module for buddylist actions (in fact I already started one for the exact same use case you mention).

Give it a try and let me know - I'm ready to commit it ASAP as it will open the way for some other features.

dldege’s picture

Using the hook from the patch here is the log handling that I was testing with.

function buddylistlog_buddylist($op, $user, $thisuser, $oneway) {
  db_query('INSERT INTO {buddylistlog} (requester_uid, requestee_uid, timestamp, action) VALUES (%d, %d, %d, "%s")', $thisuser->uid, $user->uid, time(), $op);
} 
SteveTurnbull-1’s picture

Aha! I just threw in a couple of module_invoke_all myself. This is better.

SteveTurnbull-1’s picture

Unfortunately I'm probably applying the patch to the wrong version (failed on every hunk) so no luck there ... I also tried doing it by hand and noticed that you've got a $user->id instead of a $user->uid.

Anyway, basically, great!

Steve

john morahan’s picture

Steve, you want the patch from #21, not the one at the top.

SteveTurnbull-1’s picture

Status: Active » Closed (fixed)

That didn't work for me either ... don't worry about it, I'm happy with what I've got and I can't spend more time on it -- deadlines loom.