You may have noticed a new admin link called Sugar Feeds in the admin section after you installed 5.2 and wondered what it did. In a nutshell, the Sugar Feeds feature is a way for all of your users on the system to be better informed about what is going on in the system around them.
To get the Sugar Feed system going, head on over to the Sugar Feed Settings screen and click the “Enable Sugar Feed” check box. What you now have is a choice of what modules to enable. Each of the modules will automatically (through the logic_hook system) populate the feed system when specific activities happen. For example, the Cases feed will put a feed entry in when a Case is created, or has it’s status set to “Closed” and the other module feeds work in much the same way. Now, the User Feed on the other hand is there so your users can post their own entries for other users to see. If things get out of hand all feed entries can be deleted by either the user that posted them, or an admin. So, that’s that with the basics, I bet now you want to know how to mold the Sugar Feed system to your will.
Adding A Module Feed
You may want to add a new module to be monitored by Sugar Feeds or you may want to change how an existing module is being handled. Module feeds are picked up by the Sugar Feed system by looking at the modules/<module>/SugarFeeds/ and custom/modules/<module>/SugarFeeds/ directories and finding all of the .php files in there.
If you want to override an existing feed, just place a file with the same name in the module’s custom SugarFeeds directory and it’ll use that one instead. Be sure to name the class the same as the filename (ie, CaseFeed.php == CaseFeed), otherwise we won’t pick it up. For a good example, I would use the “modules/Cases/SugarFeeds/CaseFeed.php” as an example to build from. It shows how to recognize new records, and status changes of records which will probably be your base for most feeds. Now, once you do create a new feed there is one more thing you need to do, head on over to the “Quick Repair And Rebuild” page in the Repair section in the admin panel, and uncheck everything but “Clear Sugar Feed Cache” and click “Repair.” This will tell the Sugar Feed system to throw it’s cache away and rebuild it by looking at all of the files in each of the SugarFeed directories. After that just head into the Sugar Feed Setting page again and click your new module.
Adding A User Feed Type
The other half of the feed system is the user feeds. If you click the link to the left of your name on the Sugar Feed dashlet you will notice that it will let you insert a link, a YouTube™ video, or a URL. We didn’t leave you out in the cold on these either, you can go ahead and just stick a new file in “custom/modules/SugarFeed/linkHandlers” and the Sugar Feed system will pick it up as soon as you flush the Sugar Feed cache. Check out “modules/SugarFeed/linkHandlers/Link.php” as a good simple example, or “modules/SugarFeed/linkHandlers/Image.php” as one with a bit more complexity going on.
Enjoy the new Sugar Feeds!