I am new to building modules for EE. But I have followed the getting started tutorial and the module I created shows up in the module list and when I install it I get a message saying that the install was successful but in the module list it says that it is not installed.
I have checked in the database and it is in the module table and the table that I want to it to create is created.
Please help.
Thanks
function install()
{
$this->EE->load->dbforge();
$data = array('module_name' => 'Order History', 'module_version' => $this->version, 'has_cp_backend' => 'y', 'has_publish_fields' => 'n');
$this->EE->db->insert('modules', $data);
$fields = array('order_history_id' => array('type' => 'int', 'constraint' => '10', 'unsigned' => TRUE, 'auto_increment' => TRUE), 'entry_id' => array('type' => 'int', 'constraint'=> '10', 'unsigned' => TRUE), 'order_number' => array('type' => 'varchar', 'constraint' => '250'), 'download_date' => array('type' => 'datetime', 'null' => TRUE),);
$this->EE->dbforge->add_field($fields);
$this->EE->dbforge->add_key('order_history_id', TRUE);
$this->EE->dbforge->create_table('order_history');
unset($fields);
return TRUE;
}The problem is with the ‘module_name’ value. It actually has to match the class name of the module. So, try this for your data array (assuming your class name is “Order_history”):
<?php
$data = array(
'module_name' => 'Order_history',
'module_version' => $this->version,
'has_cp_backend' => 'y',
'has_publish_fields' => 'n'
);Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.