WP-Table plugin – Fatal Error fix for WordPress 2.5+
10/05/2013: Everyone should now switch to TablePress by Tobias.
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!
UPDATE 25/05/09: WP-Table Reloaded supercedes WP-Table.
FINAL UPDATE 10/05/13: TablePress is now the revamped, next-generation of WP-Table Reloaded. It is also by Tobias Bäthge and thus Alex Rabe’s WP-Table has now become even better! Many thanks to Tobias for his hard work!
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
@Chris: Thanks for your comment! It’s great to know this solution worked for you as well.
Kewl Scene Mate. I never thought this could be a problem with the shipped WP-Table. Thanks mate. You made my day.
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! 🙂
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:
I checked the upload folder, it has “0777” permission level which supposedly no problem.
Could someone help me with this?
@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:
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!
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.
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.
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:
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!
@EngineerBoy: Thanks for copying your comment over! 🙂 An additional thank you for your suggestion/fix as well.
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.)
@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 🙂
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!
Yes this worked for me too TOP NOTCH! work
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.
It has long been looking for this information, Thank you for your work.
That works great in WordPress 2.6.3
Thanks a lot
verrrrrry helpful – thanks, man!
Great, thanks for info. works
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?
@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!
Thanks!
It’s working now 🙂
Dan
Glad it’s working for you too, Dan! 🙂 Thanks for highlighting this issue.
Thank you very much for all this. It worked perfectly for me. Almost gave up , then came the solution by Engineerboy. Using 2.6.
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!
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
@Cliff: Thanks for your comment.
In my experience, any PHP errors with
are generally to do with a random empty line before the first PHP bracketor 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.
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
It appears that the author has included the fix into the distribution.
@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!
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?
Awesome! You just made my day (actually early morning). Thanks for the fix! Now I can go to bed by 2 AM.
@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!
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!
thanks it works with wordpress 2.71
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.
🙂
I hate that error .. stared at it for 2 hours then found this post 🙂 thx mates
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
How can i add a table in the sidebar? I tried with [TABLE=id] but id doesn’t show…
Hi,
wp-Table is now continued as WP-Table Reloaded:
http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/
Best wishes!
Tobias
thank your info.
very nice.
best regard
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!
@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/
Perfect! I have a 2.7 release of mu-worpdress and the reloaded plugin only works from 2.8. With the patch now is working just perfect, thanks!
@Lucho: Thanks for the heads up. 🙂 Am really glad to hear this is still somewhat useful! I think Tobias, the developer of Reloaded, has introduced some new features to the later versions so always worth a look if you’re able to upgrade from 2.7.
Thank its very helpful..
^_^