develop wall
asked 4 years ago

Hello,

I installed DWQA last week and it worked OK. Suddenly this morning, I noticed fatal errors on the site that were pointing to the DWQA plugin.

I disabled all plugins via PHPmyadmin apart from DWQA. When I try to re-activate DWQA via WPADmin, I am getting the following error:

Plugin could not be activated because it triggered a fatal error
Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in /home4/chachi1/public_html/online234.com/myjobanswers/wp-content/plugins/dw-question-answer/inc/autoload.php on line 3

I have uploaded the new autoload.php in dropbox as per your last response but it is not solving the issue.

Please assist urgently.

2 Answers
BigHug
answered 4 years ago

Dear Develop Wall,
Can you give me an admin account throught a private answer here to help me check and solve your problem ?
Regards
Rambu

DominicStaff
answered 4 years ago

Hi,
About this issue, you can open the autoload.php file in the wp-content/plugins/dw-question-answer/inc/ folder then replace with the following code:

<?php  
function dwqa_autoload_function($className) {
    $classPath = explode('_', $className);

    if ( $classPath[0] != 'DWQA' ) {
        return;
    }
    // Drop 'Google', and maximum class file path depth in this project is 3.
    $classPathSlice = array_slice($classPath, 1, 2);
    if ( count( $classPath ) > 3 ) {
        for ($i=3; $i < count( $classPath ); $i++) { 
            $classPathSlice[1] .= '_' . $classPath[$i];
        }
    }
    $filePath = DWQA_DIR . 'inc/' . implode('_', $classPathSlice) . '.php';
    if ( ! file_exists( $filePath ) ) {
        $filePath = DWQA_DIR . 'inc/' . implode('/', $classPathSlice) . '.php';
    }
    if (file_exists($filePath)) {
        require_once($filePath);
    }
}
spl_autoload_register('dwqa_autoload_function'); 

?>

Hope this helps !

Powered by DW Question & Answer Pro