We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Installing my module: Not installing, but no errors either

Development and Programming

Michael Gatto's avatar
Michael Gatto
1 posts
15 years ago
Michael Gatto's avatar Michael Gatto

Hi, I wrote up a simple module following the official EE2 module tutorial. After uploading, the modules page in Admins sees it and I click the install link. The subsequent page is the listing of modules again with a flash message at the top of the page saying “module installed successfully”. However, the listing says “Not Installed” in red. Indeed, templates calling this module via the {exp:} syntax return an error message saying the module is not installed.

I see no error messages and my server logs show nothing out of the ordinary. Below is my upd.cfa_bios.php. How can I find out what I did wrong in writing the module?

Thanks!


<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 
 * @author mgatto
 *
 */
class Cfa_bios_upd { 

    /**
     * 
     * @var unknown_type
     */
    var $version = '0.9.0';
    
    var $name = 'CFA Staff and Faculty Biographies';
    
    /**
     * 
     * @return unknown_type
     */
    function Cfa_bios_upd() 
    { 
        // Make a local reference to the ExpressionEngine super object
        $this->EE =& get_instance();
    } 
    
    /**
     * 
     * @return unknown_type
     */
    function install() 
    {
        $errors = array();
        
        try {
        $this->EE->load->dbforge();
    
        $data = array(
            'module_name' => $this->name,
            'module_version' => $this->version,
            'has_cp_backend' => 'n',
            'has_publish_fields' => 'n'
        );
    
        $this->EE->db->insert('modules', $data);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        
        
        if (count($errors) > 0) {
            $this->install_errors = $errors;
            return FALSE;
        }
        else {
            return TRUE;
        }
    }
    
    /**
     * 
     * @return unknown_type
     */
    function uninstall()
    {
        $this->EE->load->dbforge();
    
        $this->EE->db->select('module_id');
        $query = $this->EE->db->get_where('modules', array('module_name' => $this->name));
    
        $this->EE->db->where('module_id', $query->row('module_id'));
        $this->EE->db->delete('module_member_groups');
    
        $this->EE->db->where('module_name', $this->name);
        $this->EE->db->delete('modules');
    
        $this->EE->db->where('class', $this->name);
        $this->EE->db->delete('actions');
    
        return TRUE;
    }

    /**
     * 
     * @param $current
     * @return unknown_type
     */
    function update($current = '')
    {
       return FALSE;
    }
    
}
       
jschutt's avatar
jschutt
452 posts
15 years ago
jschutt's avatar jschutt

I’m running into the exact same issue!

       
jschutt's avatar
jschutt
452 posts
15 years ago
jschutt's avatar jschutt

Hey, I just figured out what the issue is… You need to make sure you don’t have any spaces in the Module name in the modules $data array.

       
Adrian Macneil (Crescendo)'s avatar
Adrian Macneil (Crescendo)
28 posts
15 years ago
Adrian Macneil (Crescendo)'s avatar Adrian Macneil (Crescendo)

Yeah, the name you insert into the database should just be the class name. If you want a longer module name, put the long name in your lang file 😊

       
Michael Gatto's avatar
Michael Gatto
1 posts
15 years ago
Michael Gatto's avatar Michael Gatto

Yeah, that was totally the issue. Thanks; I was pretty flustered with that one.

       
OsamaBinLogin's avatar
OsamaBinLogin
2 posts
14 years ago
OsamaBinLogin's avatar OsamaBinLogin
Hey, I just figured out what the issue is… You need to make sure you don’t have any spaces in the Module name in the modules $data array.

hmm.. would be nice if they stuck an error message in there. at least when some debug flag is on or something.

anyway that was my problem too - that module name should be the same name as the class in your mod. file, also same module_name in the upd. uninstall method or else it might not uninstall.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.