WP-Table plugin – Fatal Error fix for Wordpress 2.5+
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!
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
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.
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.
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!
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:
I checked the upload folder, it has “0777″ permission level which supposedly no problem.
Could someone help me with this?
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:
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!
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.
07/08/2008 at 11:04 am Permalink
Hi Joyo,
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.
Thanks for letting me know how you got on. I was very glad to read that it worked for you!
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 170Warning: 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 pathWith this line:
$csv_file = $_FILES['csv_file']['name']; // set upload pathIf 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!
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.
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.)
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
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!
21/09/2008 at 11:06 am Permalink
Yes this worked for me too TOP NOTCH! work
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.
06/11/2008 at 3:17 am Permalink
It has long been looking for this information, Thank you for your work.
24/11/2008 at 6:48 pm Permalink
That works great in Wordpress 2.6.3
Thanks a lot
25/11/2008 at 12:42 pm Permalink
verrrrrry helpful – thanks, man!
04/12/2008 at 1:41 pm Permalink
Great, thanks for info. works
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?
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/12/2008 at 10:27 am Permalink
Thanks!
It’s working now
Dan
23/12/2008 at 2:26 am Permalink
Glad it’s working for you too, Dan!
Thanks for highlighting this issue.
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.
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!
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 770Does anyone have a solution to this problem.
Thank you
30/12/2008 at 7:41 pm Permalink
@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 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.
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
18/01/2009 at 11:49 pm Permalink
It appears that the author has included the fix into the distribution.
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!
) 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!
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?
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.
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!
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!
23/02/2009 at 1:07 pm Permalink
thanks it works with wordpress 2.71
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.
18/03/2009 at 10:50 am Permalink
I hate that error .. stared at it for 2 hours then found this post
thx mates
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
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…
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
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!
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/