I recently started toying with the activity module for a community site I'm creating and have been enjoying the functionality it provides. Thanks! I've come across a scenario and am trying to figure out if the activity module can handle this or if there is another method.
I would like to create two different messages when a "story" node is created based on the value of a CCK field.
Example:
We have a community site about sports teams (content type). A user may create a story about a sports team using the node reference CCK module. I can create an activity that basically says "[user] created [news] about [team]" without an issue. However, a user may also create general community news that will not have the node reference populated. When this happens I would like the activity message to be "[user] created [news]", however I'm not finding a way to create these two conditions. I can only find node:story insert with no way to check the CCK value being null.
Any ideas?
Comments
Comment #1
bflora commentedSubscribing.
Comment #2
sirkitree commentedThe way to deal with this is to implement a hook from activity that allows you to conditionally change the message before it is saved. Take a look at the DEVELOPER.txt file that comes with the module and read about
hook_activity_record_alter. Implement this within a custom module and you will be able to check object within the $context variable for you cck field. If the field has a value, you record your regular message. If it does not, alter the message and remove "about [team]".Please reopen this issue if you have any further questions.