Coder Social home page Coder Social logo

Comments (8)

TobiasBg avatar TobiasBg commented on July 20, 2024

Hi @sanderdekroon,

thanks for your report!

I don't think that this is related to the jQuery no-conflict mode, as we would be seeing a different error message then. Also, TablePress protects against that by setting the $() function via the global jQuery object coming in as a function parameter.

Instead, it seems that the "Table Features for Site Visitors" section is not properly loaded on this page. Do you see this section on your "Edit" screen?

I actually had added some code to fix this problem in TablePress 2.0.1, via https://github.com/TablePress/TablePress/blob/2.0.1/classes/class-controller.php#L138-L145
Maybe that somehow did not work for your user account.

To verify this: Can you maybe check if this issues happens with a completely new WordPress user?

Thanks!
Tobias

from tablepress.

sanderdekroon avatar sanderdekroon commented on July 20, 2024

Thank you for your swift response :)

I've tried your suggestion by doing the following actions:

  • I updated TablePress from 1.14 to 2.0.2 with my admin account
  • I verified the error was still occurring (it was)
  • I created a new admin account and switched to it
  • I visited the edit page and the error is still occurring

I do not see a section labeled "Table Features for Site Visitors". The only sections are "Table Information", "Table Content", "Table Manipulation" and "Table Options".

The main admin account is also missing some user options like closedpostboxes_tablepress_edit and metaboxhidden_tablepress_edit. The new account however does have those options, although they are set to an empty array. Though I'm not sure how much impact these options have.

from tablepress.

TobiasBg avatar TobiasBg commented on July 20, 2024

Hi @sanderdekroon,

thanks for trying all this! It's strange the the deletion of all those user options is not working for you...

It's even stranger that the newly created account shows this problem, because it shouldn't have these set...

If possible, I'd like to take a direct look at this on your site. Could you therefore please get in touch via email (the address is on https://tablepress.org/impressum/ )? That way, I can investigate this directly. Thanks!

Regards,
Tobias

from tablepress.

sanderdekroon avatar sanderdekroon commented on July 20, 2024

Talking about user options made me think of capabilities and well.. let's just say some parts of our back-end have been dumbed down to prevent issues with less tech-savvy users. This means the "Table Features for Site Visitors" metabox is removed for every user. We do this because of reasons I will not bore you with.

In short: restoring the metabox resolved the issue! I'm sorry for wasting your time with this issue 🙇‍♂️

Though I was wondering if you might know a way to disable the options in the Features metabox by default? I've found the tablepress_table_template filter to set the default options new tables. But I have not yet found a way to set those options to false for existing tables.

from tablepress.

TobiasBg avatar TobiasBg commented on July 20, 2024

Hi @sanderdekroon,

ah, indeed, that explains it. That metabox must be present in the DOM, as the JS and the saving process will not work otherwise.

Right now, I can't think of a good way to properly hide this (I've looked into this, but only discovered a "rabbit hole" that I described in a Trac ticket (see https://core.trac.wordpress.org/ticket/17370#comment:6 ).

How have you been hiding this metabox? Maybe that will give me some inspiration?

Indeed, tablepress_table_template "only" defines the default values. To override changes that a user made, you can set the corresponding value in the Shortcode parameters (or the "Configuration parameters" field of the new "TablePress table" editor block), or (if users can edit posts and pages) even a step "later" via the tablepress_render_options filter hook, see https://github.com/TablePress/TablePress/blob/2.0.2/controllers/controller-frontend.php#L617-L627 .

Regards,
Tobias

from tablepress.

sanderdekroon avatar sanderdekroon commented on July 20, 2024

We've been removing it with a remove_meta_box function call. Specifically: remove_meta_box('tablepress_edit-datatables-features', null, 'normal');

Instead of removing the metabox, would it be possible to make the options disabled and use the default value set through the tablepress_table_template filter?

I don't have a working solution yet, but I was think along the lines of doing an additional check in the tp.helpers.options.load function. For example, disabling the inputs that are present in the tp.table.disabled_options object. This object would be empty by default, but is editable through a filter.

from tablepress.

TobiasBg avatar TobiasBg commented on July 20, 2024

Hi @sanderdekroon,

thanks for the example! Yes, this will not work as the fields are then not in the DOM.

How about instead simply hiding the meta box with some CSS code? This should be the easiest.
Something like

#tablepress_edit-datatables-features {
  display: none !important;
}

could be sufficient already.

The TablePress Extension from https://tablepress.org/extensions/input-field-size/ shows how to add CSS code to the "Edit" screen (but ignore the CSS that's in there right now, I haven't updated that for TablePress 2.0 yet).

Best wishes,
Tobias

from tablepress.

TobiasBg avatar TobiasBg commented on July 20, 2024

Hi @sanderdekroon,

I believe that we can close this, as we have found the reason for this problem and a possible solution.
If anything is still not right, please feel free to reopen with more details.

Thanks!
Tobias

from tablepress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.