Ikonoshirt_CustomAdminNotifications

Looking for an easy way to add your Magento_AdminNotifications? Here it is.

The readme is already in markdown and I think readable. So have a look. I pushed the extension to github.

Ikonoshirt_CustomAdminNotifications

As I wrote in my blog, it is important to keep the people who use our extensions up-to-date. Magento implemented a great feature to do this, the Mage_AdminNotification.

As I wrote, there should be an easy way to add RSS feeds to the existing one, here it is.

How to use

Install this module, install your own module and add a few lines to your Package/Extensionname/etc/config.xml. Just add a node to ikonoshirt/custom_rss_feeds/feeds with your RSS feed url.

<default>
    <ikonoshirt>
        <custom_rss_feeds>
            <feeds>
                <fbfeed>http://blog.fabian-blechschmidt.de/feed.xml</fbfeed>
            </feeds>
        </custom_rss_feeds>
    </ikonoshirt>
</default>

It is important, that the feed have to be an RSS feed. The following nodes are MUST per item:

  • date_added
  • title
  • description
  • url

The following SHOULD:

  • severity (int between 4 (NOTICE) and 1 (CRITICAL)) as showed in Mage_AdminNotification_Model_Inbox. If no severity is present it is 4.
    const SEVERITY_CRITICAL = 1;
    const SEVERITY_MAJOR    = 2;
    const SEVERITY_MINOR    = 3;
    const SEVERITY_NOTICE   = 4;

How to not use

Please don't spam your customer with offers, giftcodes, etc. If he likes your software and extensions, he'll come back and check for other interesting stuff. The notifications are NO advertising channel - as I already mentioned in my blog post.

Adminnotification or Magento is phoning home.

How this feature works and what we should do with it

Mage_Adminnotification

There is this tiny module, which goes us on our nerves all the time we install a new magento. It is called Mage_Adminnotification. If you don't know, what I'm talking about, maybe this picture will help you:

This little bar should be interessting for administrators, store owners, marketing and product people, but not for us developers. It is just annoying.

The workflow behind

Whenever you request a page, the Mage_AdminNotification_Model_Observer::preDispatch() method is called, which listens on controller_action_predispatch.

It checks wether an admin is logged in and checks for updates

//app/code/core/Mage/AdminNotification/Model/Observer.php:42
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
    Mage::getModel('adminnotification/feed')->checkUpdate()
}

In checkUpdate() it is checked, wether the last request for updates was more than an hour ago, if yes, the data are requested from the Magento Notifications RSS Feed and written to the database.

// app/code/core/Mage/AdminNotification/Model/Feed.php:75
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
    return $this;
}

$feedXml = $this->getFeedData();

What we should do with it

If you ask me, this notifications are awesome. I saw a few modules which use this notifications to send informations to their module buyers. We should have an easy to use extension which only needs a configuration node with an url. This url is checked regularly for updates for all the people which USE the backend.

It is really important to inform the shop owners about security problems of modules, but although to achive, that the shop owner update our modules.

Avoid spam

Please be careful with this feature. Don't send them offers, discounts or informations about new modules. This is an information channel, not a marketing channel!

Phoning home

I think this URL notifications.magentocommerce.com/community/notifications.rss is only used inside of magento, this means, every request to this RSS feed is a magento shop.

If you don't want these informations or don't want, that magento knows, that you installed their awsome software, you can disable the observer with this snipplet in a config.xml of you module:

<config>
    <adminhtml>
        <events>
            <controller_action_predispatch>
                <observers>
                    <adminnotification>
                        <type>disabled</type>
                    </adminnotification>
                </observers>
            </controller_action_predispatch>
        </events>
    </adminhtml>
</config>

Thanks to Fabrizio Branca for his gist.