Skip to content

Override of administrator classes doesn't work wen used from the frontend #20

@liviuk2

Description

@liviuk2

Hi,
I noticed that when a class from the backend has an override (so located in administrator/code) and that class is used from the frontend the override is not loaded so it is not effective.

I think the problem is here, because it is trying to get the original file from the front end (without the string "/administrator" in the path), obviously it's not finding anything so the override isn't loaded.

I think a possible solution could be replacing the highlithed row with this code:

$adminInPath = "";
// If i'm using a file from administrator with an override and I'm in the frontend
// I should ad "/administrator" before "/components" in the $realPath
if (strpos($includePath,"administrator") !== FALSE && strpos(JPATH_BASE,"administrator") === FALSE)
{
    $adminInPath= "/administrator";
}
$realPath = JPATH_BASE . $adminInPath . '/components/' . substr($filePath, strlen($includePath));

Let me know if I'm right or I'm using the plugin in the wrong way.
Thanks for your attention!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions