Support » Plugin: NS Cloner - Site Copier » Tablepress support

  • Resolved willgorham

    (@willgorham)


    First – thanks for an awesome plugin, it is a life saver for a large network that I manage. I appreciate your work!

    I am using the popular Tablepress plugin to manage and embed tables in my pages. I’ve noticed that when I have images inside of a Tablepress table, the image URLs are not correctly replaced when cloning a site. I think this is because Tablepress escapes slashes when storing the table content in the database. (Tablepress tables are stored in the _posts table as a tablepress_table post type.) E.g. http://example.com/wp-content/uploads/sites/77/2018/1/image.png becomes http:\/\/example.com\/wp-content\/uploads\/sites\/77\/2018\/1\/image.png. The domain is replced correctly, but the site ID (77 in this example) is not.

    I’m not sure what the best way to work around this would be, but support for this would be a nice benefit for all of the Tablepress users out there.

    Let me know if this is something that I should instead bring to the Tablepress developers.

    Thanks!
    Will

    • This topic was modified 3 years ago by willgorham.
    • This topic was modified 3 years ago by willgorham.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Never Settle

    (@neversettle)

    Thanks for the feedback Will! And I appreciate you going so far with the diagnosis here. My recommendation would be to check with the Tablepress devs and find out why they do it that way and if they would be willing to change it.

    Here are my thoughts on it: they might have a really good reason why they did it this way, but it’s not standard. WordPress doesn’t do anything like this, and it’s almost always best to stick within normal conventions. Static URLs in normal post content look exactly the same in the final rendered HTML as they do in the database, etc. Tablepress might be having to parse the post content further or something like that, but the way they are storing those URLs not only makes it incompatible with NS Cloner replacements but every other search and replace plugin out there (Better Search and Replace is one we use a lot ourselves, and I’m guessing it would also fail in this case if trying to replace full URLs).

    There’s also more information out there along similar lines, but the top answer from this thread:
    https://stackoverflow.com/questions/14795811/mysql-php-escape-string-why-is-it-not-saved-in-the-database-with-the-backs
    sums it up nicely: “Let me begin by saying that you should really not really store data in any particular escaped format in the database, you’ll regret it later if you need to extract it in another format or search the data for some reason later.”

    And that would be our take on it as well. The data should be stored in the DB in such away that no post-processing is required for it to be properly formatted or appear as intended. As it is right now, that’s not the case. It looks like what Tablepress is storing in the DB for URLs is useless without additional processing, and I would see that as the root cause of the problem. Even if we were to add and maintain special code just for this one exception, Tablepress data will still cause problems for other plugins out there needing to work with or alter the raw data.

    We always think it’s better to solve the root cause of something, and we wouldn’t really see an update to the Cloner to compensate for this specific quirk of another plugin as a viable option.

    Best!
    Andrew

    willgorham

    (@willgorham)

    Hi Andrew,

    Thanks for the detailed and quick response! Your argument makes complete sense to me, I’ll bring it up with Tablepress and see where I can get there.

    Thanks again!
    Will

    TobiasBg

    (@tobiasbg)

    Hi,

    for reference, the thread in the TablePress forums is at https://wordpress.org/support/topic/issues-running-search-replace-on-multisite-urls-in-table/

    To recap, this is by design. The data format in the table cells is JSON, which is why the URLs are escaped.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tablepress support’ is closed to new replies.