xoops forums

samuels

Quite a regular
Posted on: 2003/11/26 4:36
samuels
samuels (Show more)
Quite a regular
Posts: 249
Since: 2003/10/30
#1

Using notifications system on my module

I'm creating a module and I have read the wakka section that explains how to use the notification system.
But I'm unable to make it run.

I have make the following changes to my module:

In xoops_version.php
//Notification
$modversion['hasNotification'] = 1;
$modversion['notification']['lookup_file'] = 'include/notification.inc.php';

$modversion['notification']['category'][1]['name'] = 'messages';
$modversion['notification']['category'][1]['title'] = _MI_FIRMAS_CATEGORY_NOTIFY;
$modversion['notification']['category'][1]['description'] = _MI_FIRMAS_CATEGORY_NOTIFYDSC;
$modversion['notification']['category'][1]['subscribe_from'] = 'index.php';
$modversion['notification']['category'][1]['item_name'] = 'owner_id';
$modversion['notification']['category'][1]['allow_bookmark'] = 1;

$modversion['notification']['event'][1]['name'] = 'new_message';
$modversion['notification']['event'][1]['category'] = 'global';
$modversion['notification']['event'][1]['admin_only'] = 0;
$modversion['notification']['event'][1]['title'] = _MI_FIRMAS_GLOBAL_NEW_MESSAGE_NOTIFY;
$modversion['notification']['event'][1]['caption'] = _MI_FIRMAS_GLOBAL_NEW_MESSAGE_NOTIFYCAP;
$modversion['notification']['event'][1]['description'] = _MI_FIRMAS_GLOBAL_NEW_MESSAGE_NOTIFYDSC;
$modversion['notification']['event'][1]['mail_template'] = 'global_newfile_notify';
$modversion['notification']['event'][1]['mail_subject'] = _MI_FIRMAS_GLOBAL_NEW_MESSAGE_NOTIFYSBJ;


In my post.php file

$notification_handler =& xoops_gethandler('notification');
    
$tags = array();
    
$tags['name'] = '';
    
$tags['url'] = '';
    
$notification_handler->triggerEvent('messages'$owner_id'new_message',$tags);


In my index template i have added:

<{include file:'db:system_notification_select.html'}>


When I go to the index y can see the notification block but it says Bookmark this item (no notification).

Why? Thank's for your time.

mvandam

Quite a regular
Posted on: 2003/11/26 5:59
mvandam
mvandam (Show more)
Quite a regular
Posts: 253
Since: 2003/2/7 1
#2

Re: Using notifications system on my module

You may need to specific 'lookup_func' in addition to 'lookup_file'. (Or omit both for now)

Also, go to your module preferences and make sure you enable all notification events. Since you allowed bookmarking, that option seems to be showing up correctly. (No notification simply means that 'bookmarking' doesn't create notifications, just a link so someone can find a disucssion again later.)

Does you new event show up in the module preferences?

Mithrandir

XOOPS is my life!
Posted on: 2003/11/26 7:43
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#3

Re: Using notifications system on my module

Did you copy the file notification.inc.php from e.g. news/include to yourmodule/include/notification.inc.php?

samuels

Quite a regular
Posted on: 2003/11/26 15:24
samuels
samuels (Show more)
Quite a regular
Posts: 249
Since: 2003/10/30
#4

Re: Using notifications system on my module

I have copied the file notification.inc.php to mymodule/include/ and the file notification_update.php to mymodule/

Perhaps it´s something related to the unique id that I must use, but I've tested it and never is null.

My module it's a modification of xtremmeguestbook module, and I'm using it to provide a presonalized guestbook for each user. It's like posting comments on user's accounts.
I very interested in notification system.

You can see in action here http://www.forjandoleyendas.com/userinfo.php?uid=1

The link "Ver o firmar en su libro de visitas"

Thank's for your time.

mvandam

Quite a regular
Posted on: 2003/11/26 17:54
mvandam
mvandam (Show more)
Quite a regular
Posts: 253
Since: 2003/2/7 1
#5

Re: Using notifications system on my module

When I try the link, I think it says 'no permission'.

Can you describe in more detail what is *not* working...

- Does your event show up in the notification block?

- Is just *part* of your event show up? i.e. is some text missing?

- Try switching 'allow_bookmark' to false (or '0') and see if that clears up your problems

- Anything else you might think is helpful for us to know?

samuels

Quite a regular
Posted on: 2003/11/27 2:23
samuels
samuels (Show more)
Quite a regular
Posts: 249
Since: 2003/10/30
#6

Re: Using notifications system on my module

I forgot the permission, the link is ok now.

I can add the notification to my notification list, but I don't receive a new pm when somebody sends a message to the board.
I'll try with allow_bookmark disabled and i'll upload the module somewhere.

Thank's for all.

mvandam

Quite a regular
Posted on: 2003/11/27 3:47
mvandam
mvandam (Show more)
Quite a regular
Posts: 253
Since: 2003/2/7 1
#7

Re: Using notifications system on my module

This is probably a stupid suggestion, but have you inserted the 'trigger' function call at the appropriate place in your module code? The event needs to be triggered (with the appropriate id number specified) for any notifications to be sent.

samuels

Quite a regular
Posted on: 2003/11/28 8:32
samuels
samuels (Show more)
Quite a regular
Posts: 249
Since: 2003/10/30
#8

Re: Using notifications system on my module

I've triggered it in my post.php file. When somebody sends a message it should add the notification, or not?

mvandam

Quite a regular
Posted on: 2003/11/28 15:48
mvandam
mvandam (Show more)
Quite a regular
Posts: 253
Since: 2003/2/7 1
#9

Re: Using notifications system on my module

Hmmm, yes, it should.

I would suggest double checking the spelling of the 'category' and 'event' you are passing to the trigger function, as well as the id number.

Also, if you know your way around mysql, (e.g. with mysqladmin) I would suggest checking the notifications table after you 'subscribe' to the event to make sure your 'subscription' is properly recorded in the table. If this is not correct then the trigger would not find any people to notify.

ealltech

Just popping in
Posted on: 1/14 4:12
ealltech
ealltech (Show more)
Just popping in
Posts: 3
Since: 1/11 22:52
#10

Re: Using notifications system on my module

I'm creating a system on module and I have read the wakka section that explains how to use the notification system. But I'm unable to make it run. I have make the following changes to my module: In xoops_version.php