• Anonymous User

    (@anonymized-18874123)


    General information:
    Problem: Errors appear in the WordPress Admin Dashboard after a WP and LLAR plugin update
    LLAR version: 2.26.16
    WordPress version: 6.7.1
    Status: Solved
    TLDR: yeah… no, just read it if you have this issue.

    Heads up
    This is a ‘heads-up’ post for people that are using wordpress version 6.7.1, upgraded the LLAR plugin to version 2.26.16 and and are now confronted with a bugggy Admin Dasboard.

    Symptoms
    After loading the Dashboard: on hovering over the main menu on the left side of the Dashboard there are no popups with sub-menu links. The screen-settings tab (top right of Dashboard page) does not do anything when clicked, and the dashboard widgets will not open, or be dragged to re-arrange them. The errors apparently only affect the Admin Dashboard page, all other Admin pages seem to be working normally.

    If you are experiencing (some or all of) these symptoms, you can check it by disabling the LLAR plugin, and checking that the Admin Dashboard page works normally again. If, after re-enabling the LLAR plugin, the symptoms return, then this fix is most certainly for you.

    Troubleshooting
    After enabling the WP debug log (in wp-config.php) and loading the dashboard, the debug-log said:
    PHP Fatal error: Uncaught Error: Call to undefined method LLAR\Core\Helpers::wp_locale()

    Cause of the problem
    The LLAR plugin is calling a function wp_locale(), which does not exist in the LLAR\Core\Helpers class. This breaks the WordPress dashboard. Since plugin updates often are few and far between, and since my client stubbornly insisted on keeping this plugin, I had to go in and fix it manually. Which was extremely easy by the way, so there is no excuse for the LLAR developers to not fix this issue.


    How to Fix it
    ? navigate to: /wp-content/plugins/limit-login-attempts-reloaded/views/chart-failed-attempts.php
    and download the file to your computer. Open it with your favorite coding app.
    ? in the file you need to fix issues on three seperate lines: 201, 235 and 255.
    ? on line 201, find this code:
    return context.raw.toLocaleString('<?php echo esc_js( Helpers::wp_locale() ); ?>');
    then replace the bit that says Helpers::wp_locale() with get_locale, so it looks like this:

    return context.raw.toLocaleString('<?php echo esc_js( get_locale() ); ?>');

    ? now do the exact same thing on lines 235 and 255, replacing Helpers::wp_locale with get_locale().

    Optional Bonus Fix
    For those of you that really like clean code: your optional Bonus fix concerns an empty styles tag on
    line 169: canvas id="llar-api-requests-chart" style=""></canvas>
    This not only offends WordPress, it will also offend the coding app you use (I’m using VSC, but I imagine PHP storm will agree), and it could possibly trigger your secretly budding vanilla-OCD. You can simply remove the style tag completely, but you can also choose to add some sweet css styles instead:
    style="movie-snacks: popcorn('hot','salted-caramel');". This will definitely spruce up your LLAR plugin.

    Finishing up
    When you’re done mopping up the debris you should make a full backup of your WordPress website (seriously: do not skip this step!). You can use a plugin, or do it manually via FTP with Filezilla for the files, and something like MySQL workbench for the database. Or you can rough it and export the database directly from PHP MyAdmin. Your mileage may vary. (I now realise I probably should have opened with the backup routine, sorry, my bad). When you have insured there is a foolproof way back if things go South, return the modified file to the /wp-content/plugins/limit-login-attempts-reloaded/views/ folder. Before you go and test it, make sure you clear all active caches (like Redis, Memcache, your superfancy caching plugin and, if possible, clear the server cache and your browser’s cache as well).
    Better safe than sad, and all that jazz.

    Testing the goods
    Now, log into your website using an anonimous browser window (so no cookies are loaded, and also to make sure that the browser cache (that you neglected to purge) is bypassed). If you did everything right, the Dashboard will load and it will work as advertised again. Happy Days!

    But if you made a random spello, well then your wordpress will die a firy white death. So make sure you have Filezilla or something similar standing-by to quickly upload the original version of the file, in case WordPress dies. And if that happens, just go back to the LLAR file and try it again. In the end you will surely prevail. I do hope the developer’s will read this and take some action, because this plugin behaviour is not at all working for me right now ??

    Thanks for your time and attention, and good luck with solving the issue.
    And generally, have a great and bug-free day!

    Hans.

    Full disclosure: I had help from the ChatGPT Code Copilot while studying the WordPress Debug logfile ??

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPChef

    (@wpchefgadget)

    Are you saying you don’t have a wp_locale() function in the \core\Helpers.php file? B/c if you download the plugin, you’ll notice that the function is there. Is it possible that your file got corrupted or the end got cut off? Or it hasn’t updated for a while and you used the old version of the file?

    It says “LLAR version: 2.26.16” isn’t that the newest version?

    Plugin Author WPChef

    (@wpchefgadget)

    If you have issues (temporary or ongoing) with file permissions, the mentioned file might not have updated, while the other ones have. This is one way the file got outdated. Another way could be during its update there was a glitch (network related, server overloaded, out of disk space etc) and the bottom part of the file got lost (got written incompletely to the file). You can try to delete the plugin, install it again and check if the file is complete after that. If it is, you should see the error.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.