FOR ARCHIVAL PURPOSES ONLY

The information in this wiki hasn't been maintained for a good while. Some of the projects described have since been deprecated.

In particular, the "Ushahidi Platform v3.x" section contains information that is often misleading. Many details about this version of Platform have changed since.

This website is an extraction of the original Ushahidi wiki into a static form. Because of that, functions like logging in, commenting or searching will not work.

For more documentation, please refer to https://docs.ushahidi.com

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a libraries folder within your plugin (if you don't already have one).
  2. Within this folder, create a file called [my_plugin_name]_install.php. Please note that [my_plugin_name] is the same exact unique name of your plugin.
  3. This library file is actually a PHP class that contains 2 methods. A constructor is optional. The required methods are run_install() and uninstall(). The plugin activator built into Ushahidi looks for these two methods when activating or deleting plugins.
  4. Please note that the class name must begin with a capitalized letter.
  5. Here's an example:

    Code Block
    languagephp
    class My_plugin_name_Install {
    
        /**
         * Constructor to load the shared database library
         */
        public function __construct()
        {
            $this->db =  new Database();
        }
    
        /**
         * Creates the required database tables for my_plugin_name
         */
        public function run_install()
        {
            // Create the database tables
            // Include the table_prefix
            $this->db->query("
                CREATE TABLE IF NOT EXISTS `".Kohana::config('database.default.table_prefix')."ELLO_table`
                (
                    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
                    `incident_id` INT NOT NULL COMMENT 'incident_id of the new report that is created',
                    `user_id` INT NOT NULL COMMENT 'user_id of the user that performed this assessment',
                    PRIMARY KEY (id)
                );");
        }
    
        /**
         * Deletes the database tables for my_plugin_name
         */
        public function uninstall()
        {
            $this->db->query("
                DROP TABLE ".Kohana::config('database.default.table_prefix')."jasd_table;
                ");
        }
    }
    

Adding a New Page

see Adding a New Page

Admin Settings

See Adding Admin Settings to your Plugin

...