vijay kumar
vijay kumar

Reputation: 9

Error with undefined method CI_Loader::plugin()

I received the following error:

Call to undefined method CI_Loader::plugin() in C:\wamp\www\Code\application\libraries\DX_Auth.php on line 1233

on this code:

function captcha()
 {

    $this->ci->load->helper('url');


    $this->ci->load->plugin('dx_captcha');


    $captcha_dir = trim($this->ci->config->item('DX_captcha_path'), './');

Upvotes: 0

Views: 6326

Answers (5)

R.Balamurugan
R.Balamurugan

Reputation: 1

A simple way to solve this problem is that you just put this code in your loader.php. The plugin its works. Go to System->Core->Loader.php.

      /**
      * Load Plugin
       *
      * This function loads the specified plugin.
       *
     * @access      public
       * @param       array
      * @return      void
       */
     function plugin($plugins = array())
     {
              if ( ! is_array($plugins))
              {
                      $plugins = array($plugins);
             }

             foreach ($plugins as $plugin)
             {       
                      $plugin = strtolower(str_replace(EXT, '', str_replace('_pi', '', $plugin)).'_pi');              

                     if (isset($this->_ci_plugins[$plugin]))
                     {
                             continue;
                     }

                      if (file_exists(APPPATH.'plugins/'.$plugin.EXT))
                      {
                              include_once(APPPATH.'plugins/'.$plugin.EXT);   
                      }
                      else
                      {
                              if (file_exists(BASEPATH.'plugins/'.$plugin.EXT))
                              {
                                      include_once(BASEPATH.'plugins/'.$plugin.EXT);  
                              }
                              else
                              {
                                      show_error('Unable to load the requested file: plugins/'.$plugin.EXT);
                              }
                      }

                      $this->_ci_plugins[$plugin] = TRUE;
                      log_message('debug', 'Plugin loaded: '.$plugin);
              }               
      }

      // --------------------------------------------------------------------

      /**
       * Load Plugins
       *
       * This is simply an alias to the above function in case the
       * user has written the plural form of this function.
       *
       * @access      public
       * @param       array
       * @return      void
       */
      function plugins($plugins = array())
      {
              $this->plugin($plugins);
      }

Upvotes: 0

Alexandru Guzinschi
Alexandru Guzinschi

Reputation: 5726

I think you are trying to use an old version of DX_Auth on new version of CodeIgniter. Current version of DX_Auth is compatible with CI 2.x and is available on github.

Upvotes: 0

Christian Giupponi
Christian Giupponi

Reputation: 7618

Which version of CI are you using? Plugins has been removed since the 2.x and replaced with helper. Try to use reCaptcha instead, it has a good library.

Upvotes: 1

Moyed Ansari
Moyed Ansari

Reputation: 8461

Make sure you have moved any array values in application/config/autoload.php from $autoload[‘plugins’] to $autoload[‘helpers’] or you will notice stuff break.

This is the reference

Upvotes: 1

Aidas
Aidas

Reputation: 1249

You're trying to load a plugin and plugins are not supported, if I remember it right since CI version 2. If that's the case (which seems to be) you need to convert your plugins into helpers.

Upvotes: 0

Related Questions