• Resolved M2X

    (@m2x)


    Good day guys,

    I had a discussion with the plugin author of loco translate. And he recommend to contact you guys. Here’s the outcome:

    The JavaScript file inc/admin-panel/js/custom.js throws an error on line 21 in the profitmag_tabs function when the variable active_tab does not contain a hash of its own (like #options-group-7) When it contains something else like a URL you will get a jQuery error that will not be caught.

    This navigation tabs code runs on all admin pages (not just its own pages) and assumes that any HTML element with the class nav-tab-wrapper belongs to itself (which it won’t when it runs on all pages as it’s a WordPress style)

    So what happens is that if you visit a any other page with navigation tabs (like my plugin, or some other WordPress pages) Profitmag’s code will save an invalid active tab string to local storage (in this case a full URL rather than a hash). Any time that is then used to construct a jQuery object you will get an error.

    Alternative solutions for the theme author:

    1. Use a better way to identify your own HTML elements. A WordPress class name is not a good choice
    2. Only run your JavaScript on your own pages that actually need it.
    3. Sanity check data before using it and before saving it to local storage

    Any of these solutions will fix the problem, but I’d recommend option 2 as general good practice.

    *************************************

    Would be great if you could give feedback on the above

    Cheers,
    Michael

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter M2X

    (@m2x)

    Feedback would be appreciated.

    Philippogz

    (@philippogz)

    Is this why the tabs on the Jigoshop settings in admin don’t work?

    Philippogz

    (@philippogz)

    Hi M2X, would you be able to suggest a temporary solution? I spent a whole day trying to fix this without success. I’m about to change my theme. Thanks!

    Thread Starter M2X

    (@m2x)

    Hi Philip, sorry but no solution for now. I have different other projects and thought that at least the theme author could give feedback on that. I saw that you’re also located in Germany. If you provide your website I can contact you directly. So we can keep each other updated.

    Cheers,
    Michael

    Theme Author Rigorous Themes

    (@wpgaint)

    Thank you for the report and suggestions. We will check and update our theme in next version.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bug report: JS throws error in the profitmag_tabs function’ is closed to new replies.