Tuesday, October 25, 2011

Converting M1.9 Plug-ins to M2

Now that we're well into Moodle 2 (M2), with the current stable release being 2.1.2, I thought it would be a good time to revisit converting legacy Moodle code to the new platform.

You may ask why I am doing this at such a late date? For four reasons:
  1. Many existing users of Moodle have not taken the plunge to M2 yet, but will be over the next several months.
  2. There aren't many complete guides to converting code out there, so it should prove to be a helpful exercise to document this as I do it.
  3. While I have converted a number of plug-ins to M2 in the past 1.5 years, I haven't done it recently.
  4. I miss touching code!
My goal here will be to take something existing in the community, that was useful in 1.9 (and earlier) but has not yet been ported to M2, and port the code while documenting my efforts here in this blog. As I go, I will use the resources in the community, and share them with you, so that we can all learn the best way to do this and learn the best places to find our information. (I will cheat a bit and use the documents we have created here at Remote-Learner used by our development team as well). I'm pretty sure we will also learn what not to do!

I will start with a popular block, posted at moodle.org, called "Twitter Search". This block allows you to display a block on a Moodle page that displays tweets from defined search tags. Each block can be configured to display different hash tags.

Over the next few days, I will begin the process of porting it to Moodle 2.1, and document my efforts here. When done, there will be a working M2 version of this block that can be used by the community.

After that, we'll try some other plug-ins. Post your suggestions here or to my twitter feed.

3 comments:

  1. Hi Mike,

    Loved this series of blogs and we found them very useful! Here at Totara LMS we developed a tool to help with many of the more common changes, and we've released it to the community in case anyone else out there still needs to port 1.9 code to 2.x.

    It's a simple PHP web app, designed to be run on a Linux server under Apache, where the code to be converted is somewhere on the same machine - the developer's local dev machine usually.

    https://github.com/totara/moodle2_code_converter

    ReplyDelete
  2. Hi Claran. Thanks for that information. I'll check out your converter!

    ReplyDelete
  3. As far as I know it was not only you who was late to move to Moodle 2, I still see some people who are getting updated to M2 now. As M2 has some more features and functionalities it will be good to move to it.

    ReplyDelete