M
M
midarovrk2017-02-19 17:00:41
DLE
midarovrk, 2017-02-19 17:00:41

How to prevent publication of news without selecting a category on DLE?

Hello.
Any DLE experts here?
Help solve the problem.
I have a module on dle, which itself publishes news on the site, you can say Bot. It happens that sometimes this bot publishes news without categories, i.e. does not select any of the categories. How can you prevent such news from being published?
I googled and found this - https://dle-faq.ru/faq/phpquest/755-zapret-publika...
There are two ways to prohibit adding news without selecting categories, but these two methods work when adding news manually, i.e. e. a human, but for some reason they don’t work on a bot, it still publishes news. How else can you disable posts on dle without selecting categories?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2017-02-19
@entermix

Do you need to correct the module engne/modules/addnews.php
Or do you need a ready-made code?
UPD: Something like this, but did not check:
In the file:
Find:
Add above:

if (count($category_list) < 1){
    $stop .= "<li>Не выбрано ни одной категории</li>";
}

But this will only work if your module adds news through a form on the site, and not directly to the database, otherwise you need to correct the module itself, which in general would be more correct in this case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question