Difference between revisions of "Notifications API"

(The First Notification)
(Preparing the Development Environment)
Line 16: Line 16:
 
==Preparing the Development Environment==
 
==Preparing the Development Environment==
 
'''1.''' We will assume that you're already created community type '''example''' plugin which will be triggered when user changes its profile<br/>
 
'''1.''' We will assume that you're already created community type '''example''' plugin which will be triggered when user changes its profile<br/>
If not, you can download '''empty example plugin''' from [http://documentation.jomsocial.com/downloads/notifications_empty_example.zip this link], install it in Joomla and enable the plugin. It is named '''Community - Notifications Example'''<br/>
+
If not, you can download empty example plugin from [http://documentation.jomsocial.com/downloads/notifications_empty_example.zip this link], install it in Joomla and enable the plugin. It is named ''Community - Notifications Example''<br/>
 
'''2.''' Navigate to your database and '''empty''' these two tables, so they dont have any records at all<br/>
 
'''2.''' Navigate to your database and '''empty''' these two tables, so they dont have any records at all<br/>
 
a) '''prefix_community_notification'''<br/>
 
a) '''prefix_community_notification'''<br/>
 
b) '''prefix_community_mailq'''<br/>
 
b) '''prefix_community_mailq'''<br/>
 
'''3.''' Have at least two (2) users at your test sites and know their '''ID's'''
 
'''3.''' Have at least two (2) users at your test sites and know their '''ID's'''

Revision as of 14:14, 1 October 2013

Overview

The built in notification system, first ever in Joomla, allows your app to keep the user (or group of users) informed about various different events. Think of notifications as important alerts that user would be interested to read and keep track of it.
Notifications can be generated everywhere. In your component or plugins and later displayed inside JomSocial notification system.
This tutorial will show you how, but since we do not have idea of any third-party component we could use :) the examples will be done on a community plugin which will be triggered at onAfterProfileUpdate event
If you don't know how to create plugin which will be triggered on this event, we suggest you to check this guide

Implementing it in your component anyway

As stated in overview of this tutorial, we will generate notifications using community plugin.
You will most likely want to create notifications inside your component, or your plugin. The following tutorial will work fin any of this cases. You only need to determine at what point in your code the notification will be created and just load the JomSocial Core Libraries file.

require_once JPATH_ROOT .'/components/com_community/libraries/core.php';


Following the tutorial explained bellow will work just fine for your extension too

Preparing the Development Environment

1. We will assume that you're already created community type example plugin which will be triggered when user changes its profile
If not, you can download empty example plugin from this link, install it in Joomla and enable the plugin. It is named Community - Notifications Example
2. Navigate to your database and empty these two tables, so they dont have any records at all
a) prefix_community_notification
b) prefix_community_mailq
3. Have at least two (2) users at your test sites and know their ID's