WP-Table plugin – Fatal Error fix for Wordpress 2.5+

flick » 27 June 2008 » In Plugins, Tips »

25/05/2009: Now superceded by WP-Table Reloaded – see below for info!

WP-Table plugin by Alex Boelinger is a unique Wordpress plugin that allows admins to create tables, by this I mean the ones with rows and columns like in Excel, easily in Wordpress. It is the only one that I am aware of at the moment that makes it possible to add actual tables without putting-in extra HTML when creating new posts and pages.

However, activating the latest version (1.52) of the plugin triggers a fatal error (shown below) in Wordpress 2.5+:

Plugin could not be activated because it triggered a fatal error.

Fortunately there is a quick fix that can be done to resolve this issue, where the full credit for this solution goes to Michael Bester, the developer of the Kimili Flash Embed, who posted a comment on Jovel Stefan’s Embedded Video Plugin post about a fix to ensure that a plugin should check for the buttonsnap class upon activation.

This class is used to add a button to your Wordpress editor, and should only ever be loaded once, so if any other plugin uses buttonsnap, it will cause the fatal error to occur.

To resolve this problem, find Line 344 in wp-table.php

require_once(WPTABLE_ABSPATH.'js/buttonsnap.php');

and add before it:

if(!class_exists('buttonsnap'))

So ultimately you should see this:

// ButtonSnap needs to be loaded outside the class in order to work right
if(!class_exists('buttonsnap'))
require_once(WPTABLE_ABSPATH.'js/buttonsnap.php');

I tested this on a local install of Wordpress 2.5.1, and it worked very well. This quick fix has also been posted on the Wordpress Support Forums, and hopefully others will find it helpful as well.

Any feedback would be brilliant! If it works for you, please let me know by posting in the comments. Similarly, if it doesn’t work for you, then again, please do post! I don’t see the plugin requiring any further edits for the time being (apart from new features) and am confident that it will also work with later Wordpress versions as well.

UPDATE 20/07/08: Apparently the plugin does work with WP 2.6!
UPDATE 28/12/08: And in WP 2.7 as well!

FINAL UPDATE 25/05/09: WP-Table Reloaded has been released by Tobias Bäthge, and is officially the next generation of our beloved WP-Table plugin. WPT-Reloaded even allows you to import your old WPT tables, and I can testify that it works seamlessly.  Thanks to Tobias for his hard work!

Tags: , , , , , , , , , , ,

Trackback URL

43 Comments on "WP-Table plugin – Fatal Error fix for Wordpress 2.5+"

  1. flick
    chartzog
    05/07/2008 at 4:01 pm Permalink

    I installed the WP Table plugin on my WordPress 2.5.1 database, and yes, initially WP Table did produce the fatal error as described. I added the fix described above and it now works as advertised. I look forward to using wp table as I really love tables.

    Chris
    http://www.chris-hartzog.com

  2. flick
    flick
    13/07/2008 at 2:50 am Permalink

    @Chris: Thanks for your comment! It’s great to know this solution worked for you as well.

  3. flick
    iwebie
    14/07/2008 at 5:20 pm Permalink

    Kewl Scene Mate. I never thought this could be a problem with the shipped WP-Table. Thanks mate. You made my day.

  4. flick
    flick
    20/07/2008 at 3:21 am Permalink

    Apparently WP-Table still works with WP 2.6!

    With thanks to jhsesq of jhsiess.com who is using it on his site.

    @iwebie: Thank you for your friendly comment! It’s made my day! :)

  5. flick
    joyo
    06/08/2008 at 5:30 pm Permalink

    Yes, it can be activated in WP 2.6, however when i tried to upload the .csv file it didn’t work, it creates error with following message:

    ERROR : File cannot be saved. Check the permission of the wordpress upload folder

    I checked the upload folder, it has “0777″ permission level which supposedly no problem.
    Could someone help me with this?

  6. flick
    flick
    07/08/2008 at 1:58 am Permalink

    @joyo: Thanks for your message. I had a look into this, and found I also had the same issue described by yourself. Apart from pointing out the usual ‘777 is dangerous!‘ message, I’m happy to say that there seems to be a quick and easy solution.

    The solution is with thanks to Pinoy Console, who talked about how he solved an image upload error to /uploads.

    The instructions are quite straightforward, but what I actually did was to just:

    1. Click on Settings then Miscellaneous
    2. Click on Save

    This is because the value of my “Store Uploads in this folder” was already wp-content/uploads.

    This worked for me, and I hope you find this helpful as well!

  7. flick
    joyo
    07/08/2008 at 5:05 am Permalink

    Hi Flick,

    Thanks for the quick response,
    I changed the “Store Uploads in this folder” has already as what Pinoy Console and you suggested. And yes it works very well, thanks…but when i changed the permission level to 755, it didn’t work as it in 777. Thus i think i’ll keep the permission level to 777. Ok then, thanks again.

  8. flick
    flick
    07/08/2008 at 11:04 am Permalink

    Hi Joyo,
    Thanks for letting me know how you got on. I was very glad to read that it worked for you! :) Perhaps you could consider only CHMOD’ing the folder to 777 when you need to upload the csv file, since that will theoretically minimise any security risks. I found this article quite helpful in explaining about 777 in Wordpress though.

  9. flick
    EngineerBoy
    23/08/2008 at 2:02 am Permalink

    All,

    My problem was a bit different, but this seems like the right place to post it due to all the recent activity related to the WP-Table plugin. For anyone using wp-table on WordPress 2.6 and getting the following error on CSV import:
    Warning: move_uploaded_file(/home/content/c/l/e/sitename/html//home/content/c/l/e/sitename/html/wp-content/uploads/filename.csv) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/c/l/e/sitename/html/wp-content/plugins/wp-table/wp-table-admin.php on line 170

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpJG2DBQ’ to ‘/home/content/c/l/e/sitename/html//home/content/c/l/e/sitename/html/wp-content/uploads/filename.csv’ in /home/content/c/l/e/sitename/html/wp-content/plugins/wp-table/wp-table-admin.php on line 170
    ERROR : File cannot be saved. Check the permission of the wordpress upload folder

    There is a fix. In the wp-table-admin.php file, replace this line:

    $csv_file = ABSPATH.get_option('upload_path' ).'/'.$_FILES['csv_file']['name']; // set upload path

    With this line:

    $csv_file = $_FILES['csv_file']['name']; // set upload path
    If you look at the error message you can see that the ABSPATH is showing up twice in the filename, like this:

    [code='php']"/home/content/c/l/e/sitename/html//home/content/c/l/e/sitename/html/wp-content/uploads/filename.csv"[/code]

    Notice the double slash in that string, the sections just before and just after the double slash are the duplicated (in error). I’m new to WordPress, but it appears that the issue is that in 2.6 the filename (as used in this plugin) already contains the full absolute path so the ABSPATH doesn’t need to be prepended to the filename.

    As I said, I’m a WP noob so your mileage may vary, and this might break anything and everything, but it’s working for me on 2.6!

  10. flick
    flick
    25/08/2008 at 1:19 am Permalink

    @EngineerBoy: Thanks for copying your comment over! :) An additional thank you for your suggestion/fix as well.

  11. flick
    Bag O'Hammers
    27/08/2008 at 8:21 pm Permalink

    I used the code fix described above and it worked for me, which is wonderful.

    However, I cannot get the Insert Table button back to the (TinyMCE) Visual Editor. I am not a code warrior, so I’d have no idea where to look.

    Any ideas?

    (I’m not using the TinyMCE Extended plugin as it conflicted heavily with the 2.6 admin, removing all of my admin tabs.)

  12. flick
    flick
    06/09/2008 at 1:30 pm Permalink

    @Bag o’Hammers: Thanks for your comment. Have you had any luck with this yet? If not, I’ll definitely take a look into it :)

  13. flick
    Bag O'Hammers
    06/09/2008 at 2:20 pm Permalink

    Flick: No, no resolution on the button issue. For now, I’m inserting the code manually. That’s fine for me, but the other people who write for me are far less technical. Thanks for asking!

  14. flick
    james
    21/09/2008 at 11:06 am Permalink

    Yes this worked for me too TOP NOTCH! work

  15. flick
    Mike
    05/11/2008 at 8:52 pm Permalink

    THANK YOU! It worked perfectly. I had an issue when doing an upgrade to a newer version of wordpress. Wp-Tables was working perfectly. Upgraded, then re-activated and got fatal error. Thank you for this great, EASY fix.

  16. flick
    Raymond
    06/11/2008 at 3:17 am Permalink

    It has long been looking for this information, Thank you for your work.

  17. flick
    Marion
    24/11/2008 at 6:48 pm Permalink

    That works great in Wordpress 2.6.3
    Thanks a lot

  18. flick
    Roland
    25/11/2008 at 12:42 pm Permalink

    verrrrrry helpful – thanks, man!

  19. flick
    rafael
    04/12/2008 at 1:41 pm Permalink

    Great, thanks for info. works

  20. flick
    Dan
    19/12/2008 at 12:19 am Permalink

    Hi there,
    I tried to use Wp Table with Wordpress 2.7 and I’m not seeing any Mange area. Do you have any idea how to fix this?

  21. flick
    flick
    22/12/2008 at 12:10 am Permalink

    @Dan: Thanks for your comment. This is one thing I hadn’t thought of at all, and now that I’ve finally upgraded a few of my blogs to 2.7 (including this one) I can confirm that the interface for WP-Table can now be found under Posts in the new dashboard. Hope this helps!

  22. flick
    Dan
    22/12/2008 at 10:27 am Permalink

    Thanks!
    It’s working now :-)
    Dan

  23. flick
    flick
    23/12/2008 at 2:26 am Permalink

    Glad it’s working for you too, Dan! :) Thanks for highlighting this issue.

  24. flick
    Salihu
    26/12/2008 at 1:20 am Permalink

    Thank you very much for all this. It worked perfectly for me. Almost gave up , then came the solution by Engineerboy. Using 2.6.

  25. flick
    flick
    26/12/2008 at 2:23 am Permalink

    Glad you found a solution that worked for you! :) WP-Table is a great plugin imho and I am glad that even though development has ceased, it still works with 2.7!

  26. flick
    Cliff
    30/12/2008 at 10:20 am Permalink

    I’ve got a different problem I’m hoping someone else has seen.

    I’m getting this message when I try to save a posting with a table in it.

    Warning: Cannot modify header information - headers already sent by (output started at /home/irsphone/public_html/wp-content/plugins/wp-table/wp-table.php:1) in /home/irsphone/public_html/wp-includes/pluggable.php on line 770

    Does anyone have a solution to this problem.

    Thank you

  27. flick
    flick
    30/12/2008 at 7:41 pm Permalink

    @Cliff: Thanks for your comment.

    In my experience, any PHP errors with Cannot modify header information – headers already sent are generally to do with a random empty line before the first PHP bracket < ? or after the last PHP bracket ?>.

    So it might be worth checking at your wp-table.php file and making sure there are no empty spaces (white space) before (and after) these PHP brackets - it might be an idea to use a text editor such as NotePad or even Notepad++ since a WYSIWYG editor sometimes adds extra space etc.

    Hopefully this might help! An additional reference you might want to consider might be this article by Hongkiat.

  28. flick
    rhaya
    07/01/2009 at 4:16 pm Permalink

    This plugin looks very close to what I am looking for. I have a couple questions though before I take the time to implement it. First (and most importantly) is is possible to have a link to a PDF in one of the cells? And secondly, I assume it’s possible for a new row to be added in somewhere in the middle (and not the end) of the table? I could not tell from the screenshots. Thanks, and thank you even more for posting the fix to make this with compatible with 2.7

  29. flick
    Rick
    18/01/2009 at 11:49 pm Permalink

    It appears that the author has included the fix into the distribution.

  30. flick
    flick
    19/01/2009 at 12:01 am Permalink

    @Rick: Thanks for your comment. I would have said ‘Great news!’ since it might have possibly meant that the developer might be actively developing WP-Table again (good news for all of us who use it! :D ) but at the moment, looking on both the WP Plugins Repository and also Alex Rabe’s own site, this fix doesn’t seem to have been included either of these two distributions.

    Would it be possible for you to provide a link to the new distribution at all please? :)
    I think many people would find it very helpful.

    Thanks!

  31. flick
    de
    06/02/2009 at 12:22 pm Permalink

    I try to add a table but WP return this error:
    “Error : Table cannot insert to database”

    Update and delete works

    Can you help me?

  32. flick
    Melinda
    07/02/2009 at 7:54 am Permalink

    Awesome! You just made my day (actually early morning). Thanks for the fix! Now I can go to bed by 2 AM.

  33. flick
    flick
    07/02/2009 at 2:15 pm Permalink

    @rhaya: Apologies for the late reply – I only just realised your comment was still in pending! In answer to your question, what I have done is to take a screenshot of the interface for your reference, which you can see at this link below:

    http://g.imagehost.org/0745/table.png

    which show you can insert rows (and columns) in between others in WP-Table. As far as I am aware, the ‘insert’ link adds a row ‘above’ the clicked link.

    And as HTML is allowed in the cells, you can add a link to a pdf file.

    @de: Is it possible to drop me an email so I can take a look myself please?

    @Melinda: Glad you found it helpful:) Hope you had a good well deserved rest!

  34. flick
    Alex
    22/02/2009 at 9:05 pm Permalink

    Yeah! Thanks for that fix. I had two installation of WordPress, the first was version 2.6.3 and there were no problems activating the plugin, but on the other blog with version 2.6.2 the activation failed. But with your mentioned fix it works!
    Thanks again!

  35. flick
    pagerank domains
    23/02/2009 at 1:07 pm Permalink

    thanks it works with wordpress 2.71

  36. flick
    Rebecca Sweinhagen
    03/03/2009 at 11:31 pm Permalink

    YOU are my hero.
    I’m managing a small online gallery & portfolio and wanted a table I could control and was so disappointed when this didn’t work properly. Thank you so much for the instructions to fix it!

    You earn the hero of the day award.
    :)

  37. flick
    webdesign
    18/03/2009 at 10:50 am Permalink

    I hate that error .. stared at it for 2 hours then found this post :) thx mates

  38. flick
    Tom
    03/04/2009 at 5:38 am Permalink

    I am also getting the error “Error : Table cannot insert to database” when trying to make any changes to the existing tables, creating a new table or importing a csv.. Can anyone help? Thanks

  39. flick
    Fly08
    16/04/2009 at 8:19 am Permalink

    How can i add a table in the sidebar? I tried with [TABLE=id] but id doesn’t show…

  40. flick
    Tobias
    11/05/2009 at 3:48 pm Permalink

    Hi,

    wp-Table is now continued as WP-Table Reloaded:
    http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/

    Best wishes!
    Tobias

  41. flick
    vote4theusa
    19/01/2010 at 5:48 am Permalink

    Would it be possible for you to provide a link to the new distribution at all please? :)
    I think many people would find it very helpful.

    Thanks!

  42. flick
    flick
    04/02/2010 at 1:21 am Permalink

    @vote4theusa: Thanks for your comment. I think I have included links to the new WP-Table Reloaded (above and below the post) but to make it stand out more, here is the link again :) :

    http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/

Trackbacks

  1. WP Table di Wordpress | NaraKrisna 06/10/2008 at 7:14 am

    [...] ngga sia-sia nih install plugin WP table fix dan ternyata perbaikannya cukup mudah. Cari file wp-table.php dan liat baris ...

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to Comments