Fixing Call to undefined method stdClass::onDisplay() Error in Joomla

May 4, 2012

I recently had to do some upgrades on very old Joomla sites, which were running an outdated version of Joomla 1.5.

Due to the circumstances of the upgrade, I ended up having some issues with missing plugins and had to basically recreate the site.

After everything was up and running, I got an error indicating that the “onDisplay()” method was undifined.

The basic error is here:

Fatal error: Call to undefined method stdClass::onDisplay() in /wour_website_directory/libraries/joomla/html/editor.php on line 268

This error is caused by Joomla attempting to register a plugin on the editor page, which is missing or otherwise invalid. On this page, Joomla loops through installed plugins and one of the ones that it thinks is installed, as per the mysql database, is actually missing.

To fix this, you need to identify the bad plugin and disable it.

The easiest way to do this is to change line 268 to print the name of the plugin in the event of an error.

Change line 268 of editor.php from:

$resultTest = $plugin->onDisplay($editor);

To:

//$resultTest = $plugin->onDisplay($editor);
if (method_exists($plugin, 'onDisplay')) {
     $resultTest = $plugin->onDisplay($editor);
}
else{
     $resultTest = false;
     echo '<h4>Bad Plugin: '.$plugin->name.'</h4>';
}

This comments out the original line 268, see the part with “//,” and then checks to see if the class method named “onDisplay” exists before attempting to use it.

If it is not installed correctly, you will see the plugin name printed and can disable(or reinstall) it via the plugin manager.

The plugin name printed may not be identical to its actual name as seen in the plugin manager, but you should be able to tell what it is and then disable or reinstall the missing plugin.

Note: See Savib’s Comment Below for Location in Joomla 2.5, rest should be similar

Blank Page when Editing Article

Many other editor related errors, including just getting a white page when editing an article, can be fixed by downloading and reinstalling the Joomla Content Editor JCE, or one of the other editors, like TinyMCE.

Advertisements

20 Responses to “Fixing Call to undefined method stdClass::onDisplay() Error in Joomla”

  1. Mike Says:

    Nice little bit of troubleshooting advice – helped me fix the problem rather than just sweep it under the rug :)

  2. abhik Says:

    This is probably the best problem advise I’ve ever seen, Let you fix the problem, lets you understand what is the trouble, guide you to understand you might need to fix the cause of the problem.

    No moral, judgments or any adjectives to probable readers…

    I Wish there were more articles like this…

    Thanks for your help

  3. junger95 Says:

    abhik and Mike, I am glad this helped you do some troubleshooting!

  4. Justin Mitchell Says:

    THANK YOU THANKYOU THANK YOU!!!! What a huge pain this was, got it fixed now!!!

  5. Mel Tallagsen Says:

    Awesome Fix… Thank you very much…

  6. Shine Says:

    Thank you very much , if you didn’t help i have to down a entire website thanks a lot

  7. Dana-Marie Says:

    brilliantly helpful, thank you!

  8. frankIT Says:

    worked for me too. great case-analysis. thank you for sharing.

  9. Adeola Says:

    It works perfectly, thanks

  10. savib Says:

    I just used this. THANK YOU.

    In Joomla 2.5.7 the code to replace is:

    // Try to authenticate
    if ($temp = $plugin->onDisplay($editor, $this->asset, $this->author))
    {
    $result[] = $temp;
    }

    Worked for me.

  11. Julian Says:

    Great, worked for me.
    THANK YOU

  12. junger95 Says:

    savib, thanks for posting the Joomla 2.5 Snippet! The same principals can be applied as in Joomla 1.5, but the source file is a bit different.

  13. drazzen Says:

    great, thanx!!

  14. phong Says:

    thank so much!

  15. zainalfitrez Says:

    awesome , tq , problem solve , great idea , thanks for sharing

  16. inguarkp Says:

    worked for me too (in Joomla 3.2.) great case-analysis. thank you for sharing.

  17. freefall Says:

    Thanks a ton, saved me a headache!

  18. Pilo Says:

    Nice! Was trying to figure out what was causing this Joomla error for awhile before I found this!

  19. Ingrida Says:

    Thanks!!!!!

  20. anna Says:

    Thank you soooo much <3


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s