I am writing a new module for ExpressionEngine and have a couple of settings that I want to store from the Facebook API. For example, if I wanted to store the Facebook ID and Albums they want to pull photos from do I need to store them in a custom DB table or is there a quick way to store settings, much like wp_options in WordPress?

Also, I am new to writing modules and have found a couple tutorials but most are either, short and don't have an mcp - or they stop half-way through.

Thanks for the help.

3 Answers 3


Most serious modules I know of create their own settings table. It's not ideal, but EE doesn't really offer any built in solutions for modules.

If your module has an extension, as Tom mentioned, you can use that to store a serialized array of settings. Alternatively, I know some modules add a settings column to the exp_modules table (obviously after checking it doesn't already exist) in their install script.

But in your case, it sounds like you would probably be better creating your own database tables anyway (always try to avoid giant serialized arrays if at all possible).

  • So far I've created my own table and I'll stick with that. Jan 11, 2013 at 20:04

If you only have a few settings, the most common pattern for this is to use a companion extension for your module, as extensions get a built-in settings screen for "free", avoiding the need for a separate table.

As Adrian says though, the native extension settings are stored as a serialised array, so if you have a large amount of settings data a separate table is the way to go.


Depending on the intended purpose of your addon (internal vs public use etc) and the number of settings you'll need to store you might want to consider keeping your settings within the master config.php file or within a third_party/myaddon/config.php file. If you need a user-friendly UI for the settings then it's probably not viable, but if not then creating a custom table could be overkill.

For example you could store and access an API key like this:

// Within system/expressionengine/config/config.php
$config['myaddon_apikey'] = 'xyz123';

Then within your addon:

if($this->EE->config->item('myaddon_apikey') !== FALSE)
    $apikey = $this->EE->config->item('myaddon_apikey');

This approach gives you the added benefit of being able to version your addon's config settings which is likely to be useful when it comes to deployment, configuring different environments and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.