Hi,

I use the standard activity view to show activity on different nodes and when new users are created. I also extended the view to display the user's picture next to the message to indicate what user triggered the activity message. The problem I run into is that the user's picture is not displayed when the a new user is created (when the message type is: User). When the message is of type: Node, the user's picture does get displayed.

When I try the user name field, it displays the user's name on Node type messages but on the User type messages it displays Anonymous (which obviously does not have a picture).

Thanks (and great module btw!)
Eelke

This is the SQL used to generate the view:

SELECT activity.aid AS aid,
   users_activity.picture AS users_activity_picture,
   users_activity.uid AS users_activity_uid,
   users_activity.name AS users_activity_name,
   COALESCE(activity_personal_messages.message, activity_messages.message) AS activity_messages_message,
   activity.aid AS activity_aid
 FROM activity activity 
 LEFT JOIN node node_activity ON activity.nid = node_activity.nid
 INNER JOIN users users_activity ON activity.uid = users_activity.uid
 INNER JOIN activity_targets activity_targets ON activity.aid = activity_targets.aid AND (activity_targets.uid = 0 AND activity_targets.language = '***ACTIVITY_LANGUAGE***')
 INNER JOIN activity_messages activity_messages ON activity_targets.amid = activity_messages.amid
 LEFT JOIN activity_targets activity_personal_targets ON activity.aid = activity_personal_targets.aid AND (activity_personal_targets.uid = ***CURRENT_USER*** AND activity_personal_targets.language = '***ACTIVITY_LANGUAGE***')

Comments

Scott Reynolds’s picture

Ugg! What a mess. This is why I need to finish 7.3 branch of this module and release it.

So, I am betting, that if you were to query the activity table for the user registration records, you would find that the uid column in that table for that record is 0. This is because, the $GLOBAL['user'] at the time of registration is user 0. This is because, the newly registered user is not logged in yet. They will be logged in on the NEXT page.

For you usecase,

function SOME_MODULE_activity_record_alter($record, $context) {
  if ($record->type == 'user' && $record->op == 'insert' && $record->uid == 0) {
    $record->uid = $context['account']->uid;
  }
}

And then you can rebuild your activity messages using the Admin interface to fix the existing ones.

But that doesn't solve edge cases. Cases where, a user can register but is not active until their email is verified for instance. So its not an Activity module fix, but a quick fix.

_shy’s picture

Status: Active » Closed (outdated)

D6 reached its EOL back in February 2016, and there is no active release for D6 for this module anymore.
Development or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.

If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.