How would I be able to create my own message type. Say for example I create a content type called "Calories", I use PHP to generate the title of the page based on the value of one of the fields , "Calorie Intake", in the content type. On my activity stream(site-wide) side panel it would show.... "Tom has created 50 calories." Lol, I want the activity stream to show the message "Tom has an intake of 50 calories" for the "Calories" content type specifically.
I realize out of the box, Commons has a default message for [User] created [Page Title].
I want to be able to change that message based on certain content types. Can someone give me some tips on how to solve my case? Thanks!
Comments
Comment #1
the604 commentedThe examples in the screenshot are not part of my real case, i just decided to make a few examples to show what i'm trying to achieve. I was trying to see if commons used rules or views to change the way the message is displayed when a user likes, comments, or creates a node but I can't figure out how it is done to create my own custom messages for my own custom content types.
Comment #2
the604 commentedMy quickfix, just check for $node-type on function commons_activity_streams_node_insert($node){} in commons_activity_streams.module and call your own function in there to create your custom message for different content types.
Don't think it is a good idea to edit common's code though because you will have to add your changes on every version. Will try to find a better solution when I have time.
Comment #3
devin carlson commentedYou'll want to create your own message type and then implement
hook_commons_activity_streams_message_selection_alter()and change the$message_typedepending on the$hookand the$node->type.Example: