My Moodle Plugin Crashed on the Live Site Because I Added a Column Manually

I added a new column to my plugin’s database table. Tested locally — everything worked. Deployed to the live site — plugin crashed with a “Column not found” error in front of actual users.

The column was sitting in my local database. It was not on the live server. Of course it wasn’t. I had added it by running ALTER TABLE directly in phpMyAdmin. That only touched my local machine. The live server had no idea a new column was supposed to exist.

This is the mistake I see most Moodle developers make once. You do it, the live site breaks, you manually run the SQL on the server at odd hours, and then you learn there’s a proper way to do this.

Moodle plugin database upgrade - upgrade.php and version.php diagram

Read more

A Step-by-Step Guide to Adding a Database Table to Your Moodle Block

Welcome back! In our previous adventure, we explored the basics of creating a block in Moodle. If you missed that, no worries! Today, we’re taking the next exciting step by adding a database table to our block.

Now, you might wonder, why do we need a database table? Think of it like a special notebook where our block can neatly organize and store information. It’s like a digital bookshelf for our data.

So, grab your virtual toolkit because we’re diving into the process of creating and integrating a database table in Moodle. Don’t worry; it’s not as complicated as it sounds. Let’s get started on this journey of making our block even more powerful!

A Step-by-Step Guide to Adding a Database Table to Your Moodle Block

Read more

Effortless Block Creation in Moodle: A Step-by-Step Guide

Moodle blocks are like small tools or content boxes you can put on different parts of your Moodle page, like the left or right side. The fun part is making your own blocks, where you can add special features or content to make your Moodle site unique.

​Whether you’re new to Moodle or just starting with block creation, we’ll take you through each step. By the end, you will able to create your own block for your Moodle website.

Effortless Block Creation in Moodle: A Step-by-Step Guide

Read more

Unlocking the Secrets: JavaScript sessionStorage Explained

JavaScript includes built-in storage functionality that facilitates the development of web applications. This feature enables data storage directly in the user’s browser, offering two distinct types: Local Storage and Session Storage.

Whether you’re making a personal website, a business app, or anything else, understanding how to use sessionStorage can help you make web applications that are more responsive and user-friendly.

In this tutorial, I show how you can use sessionStorage in JavaScript and when not to use it, and also show you the difference between LOCAL and SESSION storage.

Unlocking the Secrets: JavaScript sessionStorage Explained

Read more