dongyashun2559 2017-06-22 13:03
浏览 49

Moodle - 扩展现有插件

I would like to add a functionality to the existing forum plugin. The functionality I want is that I can select a published date when creating a post in a forum. When I select a date a week in the future, the post will be published (and shown to the user) a week in the future.

I think the following need to happen:

  • Add a published_date field to table mdl_forum_posts
  • Change query that shows the posts in the forum (select posts where published date is in the past)
  • Change cron that sends notifications of forum posts (that only published posts will be sent)

Now I'm wondering if there's already a plugin that provides this functionality. I've searched in plugins but couldn't find any with this functionality.

And how can I code this functionality? I don't think it's good to overwrite the core code of the plugin. How can I extend this plugin with clean structure/code?

Can you help me on my way?

  • 写回答

1条回答 默认 最新

  • dongzhan1383 2017-06-22 13:48
    关注

    The only way to add that functionality directly into the forum without changing the core code would be to make a complete copy of the forum module, rename it and then add your functionality to the copy (users would have to switch to this new version of the forum).

    In my experience, doing that will result in much more future maintenance problems than making small, careful core changes (then using git rebase to merge the changes in the future).

    The alternative might be a separate plugin that allows you to enter a post + a date and which will insert that post into the forum activity at the scheduled time (this could be in the form of a block, on the side of the page, or a local plugin that inserts a link into the forum settings, then takes you off to a separate page to do the scheduling).

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题