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

flick » 27 June 2008 » In Plugins, Tips »

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!

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

Trackback URL

28 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:

    "/home/content/c/l/e/sitename/html//home/content/c/l/e/sitename/html/wp-content/uploads/filename.csv"

    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.

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