Closed (won't fix)
Project:
Activity
Version:
6.x-1.2
Component:
Activity Contrib
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2009 at 16:25 UTC
Updated:
11 Sep 2010 at 21:43 UTC
Here's a modified version of ogactivity_og that properly handles the 'user approve' operation:
function ogactivity_og($op, $gid, $uid, $args) {
switch ($op) {
case 'user insert':
case 'user delete':
case 'user approve':
// If the group join action requires approval then the is_active
// arg will be 0 so in this case we bail out.
if (array_key_exists('is_active', $args) && $args['is_active'] == 0) {
return FALSE;
}
$node = node_load($gid);
$type = 'ogaction';
switch ($op) {
case 'user insert':
case 'user approve':
$op = 'join';
break;
case 'user delete':
$op = 'leave';
break;
}
// Check if both type and operation are
// enabled for activity. If not then stop here
if (!in_array($type, variable_get('ogactivity_token_types', array($type)), TRUE) ||
!in_array($op, variable_get('ogactivity_op_types', array($op)), TRUE)) {
return FALSE;
}
// Privacy setting check
$user = user_load(array('uid' => $uid));
if (activity_user_privacy_optout($user)) {
return FALSE;
}
// User hide activity permission check
if (user_access('hide activity', $user)) {
return FALSE;
}
$data = array(
'operation' => $op,
'node-id' => $node->nid,
'node-title' => $node->title,
'node-type' => $node->type,
);
$target_users_roles = array(
ACTIVITY_ALL => 'all',
$user->uid => 'author',
);
activity_insert($user->uid, 'ogactivity', $type, $op, $data, $target_users_roles);
break;
}
}
Comments
Comment #1
sirkitree commentedclosing. 1.x no longer supported.