I want like Facebook notification add icon when a user relationships or flag friends ( User Relationships or Flag Friend module) published some new content.
I followed this good tutorial who is the closest to do that : How to allow users to manage their own Message Stack messages?. It works perfectly, but only for the current user and not relationships or friends. I also found How to implement Facebook style Notifications for Organic Group posts?.
I would use not only for the current user but for user relationships like a Facebook notification. I tried many ways: using Rules, Views or custom development (the most closest with hook_node_insert and user_relationships_load } but without success.
The problem is you need to notify individually each of the friends, so that they can manage there own notifications. If not each time a friend removes a notification, it's removed for ALL friends.
I add a custom field of user that is fill by one each time a new content is publish with a custom module this is working but I not find a way to JOIN the QUERY with the relationship table or friends tables.
function my_module_node_insert($node){
if($node->type == 'mytype'){
db_update('field_data_field_my_field_name')
->expression('field_my_field_name_value', 'field_my_field_name_value +
:amount', array(':amount' => 1))
->execute();
//or you also can use regular query
//db_query("UPDATE {field_data_field_my_field_name} SET
//field_my_field_name_value = field_my_field_name_value + 1");
}
}
Here is the screen of the views of list "all friends" default views of Flag friends module