I am using a custom heartbeat activity message that includes a teaser of a node.
If the node is edited and the teaser changes, unfortunately the heartbeat message stays the same.
Is there a simple way (or any way) to modify the heartbeat message once it's created? Seems like if there's no automatic way to do it, I can do a hook_nodeapi on this particular node type and, if there's any heartbeat logged messages related to it, I could have it edit them. If that's not possible, maybe I could have it delete the previous heartbeat message and create a new one with the same date? Can it be done with rules?
Any insight is greatly appreciated!
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedYes, you can do that in a nodeapi hook. I did this too once. I even promoted an edited article (deleting it while copying it to the most recent activity).
The reason why i suggest this, is because it's seems like the only way? I would expect if you use rules to log the activity, and since heartbeat always shows the most recent of the "non-merged" messages, the teaser-token would be updated by rules, no?
How is it in the database? I don't think heartbeat can do anything to change the behavior, no?
Reopen this ticket if the problem is not solved or you are of the opinion heartbeat can take up the challenge.
Comment #2
sarav.din33 CreditAttribution: sarav.din33 commented@ Stalski,
Can you please post the sample code to update the heartbeat activity message through hook_node_api??
Comment #3
Stalski CreditAttribution: Stalski commentedJust do your action in the hook_node_api (delete, remove, insert, publishe, whatever).
The action could be to remove an activity log and insert another, or just update the activity record you want. This can be done since you know the actor and the node it's referring too. So plain simple
Comment #4
jienckebd CreditAttribution: jienckebd commentedThanks for a great module Stalski!
Could you provide example code from when you did this using hook_node_api? I'm also trying to do a mass update on all of my heartbeat activity.
Comment #5
jienckebd CreditAttribution: jienckebd commentedNevermind -- I got it working. My question was a little different from this. I added a new !body variable to an existing heartbeat template and I wanted my existing hearbeat entries to use the variable. I was able to update them by deleting all of the old entities and inserting new ones with the new variable values.
If anybody else is trying to do the same, here is an example script I ran to update them. Please let me know if there was a simpler method for future reference:
Comment #6
mr.andrey CreditAttribution: mr.andrey commentedI ended up using custom PHP in Rules on Update content:
I have some custom fields, so you'll need to update it to your own setup.
Cheers,
Andrey.