General discussion
New Posts Question

Hi again, it's been a while.


I was looking around and had a question. Is it possible to have the server send a webhook request, or a few, when someone makes a new topic, and change each request by category (such as posting in a category called 'games' will send one webhook but a post in a category called 'internal' would not.


Hi again, it's been a while. I was looking around and had a question. Is it possible to have the server send a webhook request, or a few, when someone makes a new topic, and change each request by category (such as posting in a category called 'games' will send one webhook but a post in a category called 'internal' would not.

Very interesting question - for my opinion something like that should be possible but to be sure about it we should ask the @admin or @adesh about it.

As far as I know You can make use of the Codoforum API and their notification system to get such a request done.


You can find a few methods in the class Notifier in:
/sys/CODOF/Forum/Notification/Notifier.php


So if for example you want to get last unread notifications you can work with:


$notifier = new \CODOF\Forum\Notification\Notifier();
$notifier->get(true);

But lets hear what our Admin will tell you about it, he is the pro and I have some general good knowledge about this and that, but very few about PHP or JS.


Kind regards, Andy smile


Very interesting question - for my opinion something like that should be possible but to be sure about it we should ask the @admin or @adesh about it. As far as I know You can make use of the Codoforum API and their notification system to get such a request done. You can find a few methods in the class Notifier in: /sys/CODOF/Forum/Notification/Notifier.php So if for example you want to get last unread notifications you can work with: ```` $notifier = new \CODOF\Forum\Notification\Notifier(); $notifier->get(true); ```` But lets hear what our Admin will tell you about it, **he is the pro** and I have some general good knowledge about this and that, but very few about PHP or JS. Kind regards, Andy ;)

Hi


You can create a simple plugin to hook into the system to achieve what you want.


What do you want to do when a new topic is created? Is it a request to external system?


Hi You can create a simple plugin to hook into the system to achieve what you want. What do you want to do when a new topic is created? Is it a request to external system?
Necessity is the mother of all inventions!

Hi!


Yes, I am looking for some way to have Codoforum when a new post is created send a webhook request to Discord to post the new topic in a designated channel so people on a Discord server will know when a new forums post is created.


Hi! Yes, I am looking for some way to have Codoforum when a new post is created send a webhook request to [Discord](https://discord.com "Discord") to post the new topic in a designated channel so people on a Discord server will know when a new forums post is created.

Hi @blockgaming

Sorry for the late reply.


So, when a new post is created this hook is called: after_reply_insert
and when a new topic is created this hook is called: after_topic_insert


Both will have lot of topic and post data that you can use for your usecase.


As to how to use them you can look at any of the existing codoforum plugins, for example:


\CODOF\Hook::add('after_topic_insert', function ($args) {
//Send discord post using $args
});

You can read this to learn how to write a plugin: https://codoforum.com/documentation/how-to-write-a-hello-world-plugin


If you are stuck or need any help during the process, please let us know


Hi @blockgaming Sorry for the late reply. So, when a new post is created this hook is called: `after_reply_insert` and when a new topic is created this hook is called: `after_topic_insert` Both will have lot of topic and post data that you can use for your usecase. As to how to use them you can look at any of the existing codoforum plugins, for example: ``` \CODOF\Hook::add('after_topic_insert', function ($args) { //Send discord post using $args }); ``` You can read this to learn how to write a plugin: https://codoforum.com/documentation/how-to-write-a-hello-world-plugin If you are stuck or need any help during the process, please let us know
Necessity is the mother of all inventions!
42
5
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft