Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey all,
When a user on my site uploads a new photo, heartbeat still calls the url of their previous photo. This would be a simple annoyance if Drupal didn't delete the old photo, but now there are a bunch of not found icons in my stream. It would be awesome if the heartbeat-user-picture token would always call the latest user picture. Honestly I have no idea on how to do that, so I am posting this here in hopes someone can help.
Thanks.
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedBy default, variables are logged to the database as is. So there is nothing I can do about that at logging time.
On runtime however, you could implement hook_heartbeat_theme_alter and loop through the messages by address to add the avatar. This is easy when you have the $heartbeatActivity->uid and $heartbeatActivity->actor.
I think there is even an example in the heartbeat_example module for this.
So in your case, some custom code will fix your problem.
If you are not a programmer, you can also choose display suite module where heartbeat exposes everything as field (message, time, avatar, ...). This will be a bigger chance to your site concept but Display Suite is definitely something to consider. It displays the nodes and users as well.
Comment #3
CoreyMoore CreditAttribution: CoreyMoore commentedStalski,
I really appreciate the help and this issue is fixed. I know I am breaking some rule here, but I really need clarification. I have been trying to figure this out for about a month and I am still stuck.
This is the code I am currently trying to use:
In my module
In my template.php file
This code is pretty much lifted right from the example module. Yet when I use this code, it causes my messages to not display at all. I must be missing something here.
Comment #4
Stalski CreditAttribution: Stalski commentedYou did register the theme hook as mymodule_theme() ?
Comment #5
CoreyMoore CreditAttribution: CoreyMoore commentedWhoops! That worked :)
Edit: Nevermind what I just wrote. This is my mistake.
Comment #6
CoreyMoore CreditAttribution: CoreyMoore commentedOk, I'm still having an issue. This is working for every heartbeat feed on the site EXCEPT for the Organic group activity block. Do I need to add something to the heartbeat_user_load for this to work in those blocks?
Comment #7
Stalski CreditAttribution: Stalski commentedNo, with the theme alter approach, it's all in your hands. So if you override it for each message, it should work.
I have no idea from here where the problem could be, can't think of anything that varies between de og activity and the rest.