please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
hello, @adesh1414127033!
Do you think it's easy to extend a little bit notifications, by adding an url to the array ?
$data = array(
'label' => 'New private message',
'cid' => 0,
'tid' => 0,
'pid' => 0,
'url' => 'profiles/14154#pms'
'notification' => 'you a have '.$nmessages.'new private messages',
'bindings' => array('title' => TOPIC_TITLE)
);
or something like that ?
thanks
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
ok, i'll have a look. If patch is okay, can you add it to next release ? ( @RonAus and @hard_as_snails are waiting for it in pm plugin
)
thanks!
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
After 2 hours trying to understand how notifications works, i've a few questions for @adesh1414127033 
$notifier = new \CODOF\Forum\Notification\Notifier();
you send it the message
$notifier->queueNotify('new_message', $data);
and after ? how are they handled (use of codo_notify_queue) ? why codo_notify_text is not purged ?
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
The problem currently is that the url is hardcoded which makes it possible to have urls only to forum topics and posts.
We will extend it to include any custom url so that you can use it in your pm notification.
is possible to know if there is already a notification of this type for a specific user ( or i'll have to code one in notifier.php) ? because I don't want to have 1000+ notifications of new pm
You don't have to do the work of fetching or displaying notifications.
You just store the data of a notification, rest is handled by codoforum.
Docs on how to add a notification is here:
https://codoforum.com/documentation/adding-notifications-to-your-plugin
and after ? how are they handled (use of codo_notify_queue) ? why codo_notify_text is not purged ?
Let me explain a bit about how the notification system works.
There are 4 important tables:
codo_notify, codo_notify_queue, codo_notify_text, codo_notify_subscribers
The table codo_notify_subscribers says, which user is subscribed to which topic or category.
The table codo_notify_text contains the actual notification data.
Now, you may ask, why two more tables to store the notifications.
The reason is performance.
Suppose, there are 1 million users subscribed to a category, whenever a user makes a new topic,
codoforum first adds a new row (lets call it "new topic created" )in codo_notify_queue and data in codo_notify_text.
Now, there is a cron job which periodically checks codo_notify_queue, then for each row in that table, it checks the subscribers for this notification "new topic created".
Since, this is a cron job, it can lazily insert millions of rows in codo_notify otherwise you would have to wait for hours to create a new topic.
Also, there is another cron job which creates a mail queue from codo_notify_queue .
So, the real notifications are actually present in codo_notify and the data in codo_notify_text
many thanks @adesh1414127033 for the explanations!
I now understand the process.
For the url, a new entry 'link_msg' in array and patch in layout.tpl do the trick:
{{#if link_msg }}
471 <a target="_blank" href="{{../url}}{{link_msg}}" class="codo_inline_notification_el codo_notification_is_read_{{is_read}}">
472 {{else}}
473 <a target="_blank" href="{{../url}}topic/{{tid}}/post-{{pid}}&page=from_notify&nid={{id}}/#post-{{pid}}" class="codo_inline_notification_el codo_notification_is_read_{{is_read}}">
474 {{/if}}
475
but I think there is something wrong in my code.
Each time I create a notifier for new message ( on_topic_view) , i have a new entry in table codo_notify_text.
But i want only one notification of new messages, not each time check is done. so I need to test if there is already a notification ( or delete it at each call) before creating the new one.
I have another problem, there is entry in table, but no notification
. I have to check this too.
Thanks for your help.
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
nop.
cannot have it working ! I miss some informations to complete,and not enough time to work on it. My forum must start before 11/01, and there is soooooo much work on the content !!
Maybe if @adesh1414127033 have time to talk to me ( irc, chat, whatever) to answer my 2000 questions...
I'll post a new version of counters with esthetic corrections tonight ( 4 counters as asked for).
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
Hi @phig330
We can have a skype conversation anytime tomorrow ?
Edit:
We are thinking of implementing notifications for new pms because we need them for implementing another feature:
http://codologic.com/forum/index.php?u=/topic/8119/moderation-don-t-work-in-3-6/1#post-17441
So, if you have already made any changes for the same let us know.
hello, @adesh1414127033 and many thanks for proposal, but I was referee all over the week end for differents competitions in France ( and as it's the beginning of the season, every WE until january!).
No, i've not made any changes on notifications, as i've not yet enough knowledge of the system to work on that.
But if i can help, i'll be great!
I pm you my skype id.
Thanks again for your great forum 
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
sorry, i did not gave you my id
: phig330 ( france)
i'll be on holiday week 52, so i'll have time to work on codoforum 
tell me if you have some time to talk about helping on project ( translations, bug tracking, minor mods, plugins ) ...
please, excuse my bad english! ( i'm french, and i know, it's not a good excuse ! ;) )
Your previous draft for topic is pending
If you continue, your previous draft will be discarded.