We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Sending notifications | Forum

Sean
Sean May 20 '14
I'm working on a new plugin and I want it to send a notification to a user, I followed the example in this forum, and also copied code from the Friends plugin and modified it to my needs. However, it does not send a notification, can anyone see what I have done wrong?


$notificationParams = array(            

'pluginKey'=>$this->pkey,

'action'=>'increaseBalance',            

'entityType'=>$this->pkey.'_increaseBalance',            

'entityId'=>$entityId,            

'userId'=>$receiver,            

'time'=>$timeStamp       

);


$notificationData = array(            

'string'=>array(                

'key'=>$this->pkey.'+increaseBalance_notification_string',                

'vars'=>array(                   

'amount'=>$amount,

'fromUsername'=>$fromUsername,

'fromUrl'=>$fromUrl,

'reason'=>$detail                

)            

),            

'avatar'=>$avatars[$avatarUser],            

'url'=>$this->router->urlForRoute('ofcreditservice_log')        

);


$notificationEvent = new OW_Event('notifications.add', $notificationParams, $notificationData);        OW::getEventManager()->trigger($notificationEvent);

The Forum post is edited by Sean May 20 '14
Alia Team
Alia May 21 '14
Sean have you checked the "Notification" section of  the "Skeleton" plugin?
Sean
Sean Jun 10 '14
Hi Aliia, yes I have, I copied and pasted it exactly, and changed the variables to what I need, and still no notifications are being added, very bizzare. I'm getting no errors either:


$notificationParams = array(

'pluginKey' => $this->pkey,

'action' => 'increaseBalance',

'entityType' => $this->pkey.'-increaseBalance',

'entityId' => $transactionId,

'userId' => $receiver,

'time' => $timeStamp

);


$notificationData = array(

'string' => array(

'key' => $this->pkey.'+increaseBalance_notification_string',

'vars' => array(

'amount'=> $amount,

'fromUsername'=> $fromUsername,

'fromUrl'=> $fromUrl,

'reason'=> $detail

)

),

'avatar' => $avatars[$avatarUser],

'url' => $this->router->urlForRoute('ofcreditservice_log')

);


$notificationEvent = new OW_Event('notifications.add', $notificationParams, $notificationData);

OW::getEventManager()->trigger($notificationEvent);

The Forum post is edited by Sean Jun 10 '14