And so begins a young padiwan learner into the world of plugin creation.
The best instruction I can give you, would be to stare at the existing core components, and other plugins that are out there currently. Stare at it long and hard. Eventually, you will see the light. Haha!
For real though, if you’re not used to this type of event driven development, it can be really loopy and confusing at first. The best thing to do is watch it in action by looking at how other people have done what you’re trying to do, then take what works, delete what doesn’t, and fill in the blanks. There is no quick lesson anyone can give on how exactly to do this, as different types of plugins will require different depths of classification and development.
Remember – you don’t have to use classes if you don’t want to. If you’re more comfortable using regular DB access functions then that’s fine.
Each data access class is constructed to represent one table. Each column in the table maps to a class member variable. When then class is instantiated and turned into an object, that object should represent the data for one row of the table.
When you call the save() method then class will determine if the row already exists and update the information in the table. If it does not exist, it will add a new row to the table.
So here is an example of using a class like this:
$house = new BP_House;
$house->roof = 'tiled';
$house->walls = 'wood';
$house->door = 'PVC';
$house->garden = 'grass';
$house->save();
So in this instance $house is a new object created from the class BP_House. When we call the $house->save() method, the data is saved to the database by the class.
Not sure if that helps at all.