Creating a forum remotely

Re: Creating a forum remotely

by Andrew Lyons -
Number of replies: 1
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Gregory,

You don't say what version of Moodle you're developing for, but there is already an infrastructure for exactly this which is the recommended approach. It's called Web Services, and configuration and details for it can be found in your Moodle Settings block at Site administration -> Plugins -> Web services.

At present there are only forum-related web service functions for:

  • get_forums_by_cours
  • get_forum_discussions

However, you should be able to write your own web services using the plugin infrastructure which will allow you to achieve what you intend without accessing the database directly. This has the main advantage that you're using established APIs which are updated when changes are made to core Moodle systems.

Alternatively, you could contribute new functions to the existing plugins and submit them back to the Moodle project so that others can benefit from them.

Andrew

In reply to Andrew Lyons

Re: Creating a forum remotely

by Gregory JB -

Thank you. So how exactly do I go about creating my own function for adding a forum? I see in Moodle that there is a list of functions that I can add to external services. So I created an external service and I want to write a new function to use with it. And how do I call these functions from outside of Moodle?

By the way, I'm using version 2.4