1
votes

Me and Some pals have created a wordpress plugin (a formbuilder). we've installed wordpress and uploaded our plugin to cpanel web hosting. Everything works great for everyone localy, however when we activate the plugin to our web host we get this error:

Fatal error: Uncaught Error: Class 'Inc\Api\Callbacks\AdminCallbacks' not found in /home/justforms/public_html/wordpress/wp-content/plugins/Kalkylator/include/Pages/Admin.php:25 Stack trace: #0 /home/justforms/public_html/wordpress/wp-content/plugins/Kalkylator/include/Init.php(33): Inc\Pages\Admin->register() #1 /home/justforms/public_html/wordpress/wp-content/plugins/Kalkylator/kalkylator.php(394): Inc\Init::register_services() #2 /home/justforms/public_html/wordpress/wp-admin/includes/plugin.php(2050): include('/home/justforms...') #3 /home/justforms/public_html/wordpress/wp-admin/plugins.php(175): plugin_sandbox_scrape('Kalkylator/kalk...') #4 {main} thrown in /home/justforms/public_html/wordpress/wp-content/plugins/Kalkylator/include/Pages/Admin.php on line 25

We are using composer and version 5.1.1 on Wordpress.

Here is the call:

namespace Inc\Pages;
/**
 * 
 */

use Inc\Api\SettingsApi;
use Inc\Base\BaseController;
use Inc\Api\Callbacks\AdminCallbacks;

    class Admin extends BaseController
    {
        public $settings;
        public $callbacks;
        public $pages = array();
        public $subpages = array();
        public function register() 
        {
            $this->settings = new SettingsApi();
            $this->callbacks = new AdminCallbacks();
            $this->setPages();
            $this->setSubpages();
            $this->setSettings();
            $this->setSections();
            $this->setFields();
            $this->settings->addPages( $this->pages )->withSubPage( 'All Forms' )->addSubPages( $this->subpages )->register();
        }

Here is the AdminCallBacks's file:

namespace Inc\Api\Callbacks;

use Inc\Base\BaseController;

class AdminCallbacks extends BaseController
{
    public function adminForms()
    {
        return require_once "$this->plugin_path/templates/admin.php";
    }
    public function adminSettings()
    {
        return require_once "$this->plugin_path/templates/settings.php";
    }

Is there something wrong with the call or is does the problem lie within cpanel or Wordpress?

All help is welcome. I'm fairly new to the stack, if there are flaws in the question please notify me so I can improve. Thanks in advance :D

1
where are your requires? do you have autoloader? - treyBake
@treyBake we're using autoloader. - Drohano
huh.. weird for a WP site xD and you can confirm it's all working as it should? - treyBake
@treyBake I can confirm that it works as it should localy. btw we used bitnami to install wordpress on our machines, do you think that might affect the outcome? - Drohano
Did you try adding back slash in the front of the namespace or use path? - SaidbakR

1 Answers

0
votes

I found the problem. Someone commented in this link.

We had forgotten to run Composer in the plugin directory on the live server.