HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Plugin Idea

Can someone make a plugin that delete a discussion that been on the forums for more then x hours.

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Check out the archive function on /vanilla/settings/advanced. Pair that with an ever changing date via a plugin and you are almost there.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • I something that can do it every 24 hours.

  • R_JR_J Ex-Fanboy Munich Admin

    You do not want to have discussions that are older than 24hours?! You should consider using a chat script... ;)

    1. Which discussions?

    Do you want to
    a) delete all discussions that have been created X hours ago or
    b) all discussions that have no comment since X hours

    2. How to start deletion?

    There is no way to do something in Vanilla every X minutes, hours, days, etc. So you need one of two solutions to trigger your plugin:
    a) you either have to configure an external cron service or
    b) the next visitor after 24hours triggers your plugin

    3. Really delete?

    Do you really want to delete them from the database? Think of discussion and comment count of your users. They will never show a sane value. For example something like this could happen:
    Today: SomeUser has 4 Discussions and 17 comments.
    Tomorrow: SomeUser has 2 Discussions and 4 comments.
    The day after tomorrow: SomeUser has 2 Discussions and 8 comments.

    That will look like a mess...


    Are you interested in learning how to write that plugin? Then start with this plugin and we will see how we can proceed.

  • Thank you for the help!
    https://vizionmc.us/

  • R_JR_J Ex-Fanboy Munich Admin

    Your plugin will be very basic. You might want to have a setting page where you can enter the amount of time to pass. And then there will be the function that does the real work. It's always best to start with a plugin that does something similar and I do not know of a plugin that deletes discussions periodically. But I know a plugin that creates a setting screen ;)

    http://vanillaforums.org/addon/howtosettings-plugin

    Get this plugin, try to understand what is in there, strip out what you do not need, let it only show one input box for the period and see if you can get that running.

Sign In or Register to comment.