HTML Logo by World Wide Web Consortium ( Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS. ocPortal 9 is superseded by Composr 10.

Head over to for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.

Is there a command to mass delete spam news?

Login / Search

 [ Join | More ]
 Add topic 
#100625 (In Topic #19758)

Community saint

So because life has gotten busy, I haven't been able to check on my site for a little over a week. I got on today only to find tons of new members (all spam bots) who created a news category called "community" and filled it with 484 spam news posts. Yeah, they've been busy....

Deleting these one at a time (since ocPortal foolishly lacks a "delete category and all posts within" feature *glares* would take ages. It has already taken me 25 minutes to just delete 75 of them. But ocPortal does have the ocCLE. So I am wondering, is there a command to delete all those news post in "community" category (since I did not create such category, and I looked, it is all spam)? Maybe rm -R community?



Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top

Not in v9. v10 will have webdav which will help a lot with this kind of thing.

OcCLE command:


:$cat_id=123456789; require_code('news'); $rows=$GLOBALS['SITE_DB']->query_select('news',array('id'),array('news_category'=>$cat_id)); foreach ($rows as $row) delete_news($row['id']);

Take backup first
Assumes primary news category is where the category is set

Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: