Support Forum
Hi SP-team,
I was in need of having tablecontrols on the menu of tinymce plugin. So, I downloaded the table plugin from tinymce.com and put it into wp-content/sp-resources/forum-plugins/tinymce-richtext/tinymce/plugins.
But it did not work. As soon as I insert 'table' in the plugins line in settings, the editor stops working - just showing an empty area. Removing the 'table' setting brings back the usual function.
Is it a version conflict, maybe? (I just used the table plugin currently online on tinymce.com)
Or is it a matter of release?
How to do it correctly?
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
oh wow... could use Andy for this as the tinymce expert... but he is gone for couple weeks on vacation... so I will see if I can help...
yes, you can add plugins... first step is as you did to upload it... but now you have to tell tinymce that you have added a plugin... and this is where I am trying to do this from memory...
you need to add a filter to your spFunctions.php file in your sp theme... something like:
add_filter('sph_mce_external_plugins', 'my_tinymce_plugin'); function my_tinymce_plugin($plugins) { $plugins[] = array('name' => 'http://url.to.plugin'); return $plugins; }
you will need to replace 'name' with the name of the plugin... and http://url.to.plugin with the url to the plugin js file..
you may also have to add a button to the forum - components - tinymce button list to get it to show up...
so give that a try and lets see where we get...
Visit Cruise Talk Central and Mr Papa's World
Seems to be more behind it!
I tried to include the above sample code into my theme's spFunctions.php, and the filter gets fired. I have just put in a debug message instead of the array modification to print_r the $plugins content and it turns out to be empty! Shouldn't there be the standard plugins in? Maybe, this is due to the 'external' ?
Do you really need to use an 'external' plugin? Essentially, the table plugin should be internal as it is uploaded to the standard plugin folder. Then just putting 'table' into the $plugins array should suffice. Maybe, there is an extra filter for 'internal' plugins?
For testing purposes, I also changed (temporarily) the install sequence in sp-tinymce-install.php adding 'table' to the plugins, de-activated and re-activared the plugin. Then I have put 'table' into TinyMEC Plugins line in admin settings and 'tablecontrols' into the PluginButtons1 line. But all I am getting are some 'graphical artefacts' in the place where the buttons should appear.
Maybe, there are some CSS issues behind that needs to be corrected to support the table buttons. Should we suspend this question until Andy is back?
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
no, the $plugins would be empty... unless you added other plugins.. its a list of user added plugins, hence external in the name... any plugins that we include in the tinymce plugin itself would not be in the list as they are not user added or external...
you are reading far too much into the name... tinymce has an init file that has to load any plugins... tinymce does not scan directories for plugins... you have to list them in the init file... and since you dont want to be editing the plugin file to add your plugin, we give you a filter to add it to the list... so anyone who adds a plugin via that filter will get it loaded too... external = user added...
which is what you did... but by using the filter, you dont have to edit the init file...
so please show me the code you added to your spFunctions.php file...
and give me a link to the plugin itself so I can download it and try to add it on one of my test sites...
Visit Cruise Talk Central and Mr Papa's World
o.K. did it this way. Please see the code below, I've put into my spFunctions. For testing purposes, I am always using absolute URLs to make sure I am on the right track. dbg_r() is my own function for var_dump the variable in my format.
It obviously does something but not the right thing - now the area of tinyMCE remains empty while loading the editor. Removing the filter brings up the tinyMCE again. Doing both, using the filter and settings line, yields the same empty editor area.
Btw, the same happens if you simply put in 'table' into the 'TinyMCE plugins' settings line in admin without running through the filter. And more: I added the 'emotions' and 'xhtmlxtras' plugins the same way and they worked out-of-the-box.
function my_tinymce_plugin($plugins) { // $plugins[] = array('name' => 'http://url.to.plugin'); $plugins[] = array('table'=> 'http://5.9.51.145/wp-content/sp-resources/forum-plugins/tinymce-richtext/tinymce/plugins/table'); wp_mail('dietmar@herian.de', 'tinyMCE_table_dbgr', dbg_r($plugins)); return $plugins; }
Here is the link tinyMCE 3.5.7 to the version I took the plugin from. It downloads as full package including all plugins.
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
will try to look further this weekend...
but why dont you try this filter:
sph_add_tm_plugin
instead... I am as new to this as you! Andy is Mr Tinymce for us...
dump out the passed in plugins arg... you might just be able to add in table to that array...
Visit Cruise Talk Central and Mr Papa's World
yup..works for me...
apply_filters('sph_add_tm_plugin', 'mytm'); function mytm($plugins) { $plugins[] = 'table'; return $plugins; }
and then add it to forum - components - tinymce plugin list and buttons...
Visit Cruise Talk Central and Mr Papa's World
btw, I can get the plugin to load using the external stuff too... but it doesnt seem to work as the plugin appears to be written with the expectation that its loaded in in the tinymce plugin directory which is unfortunate...
for reference, to load an external plugin (assuming plugin was located in sp-resources folder):
add_filter('sph_mce_external_plugins', 'mytm'); function mytm($plugins) { $plugins['table'] ='http://yoursite.com/wp-content/sp-resources/table/editor_plugin.js'; return $plugins; }
and then add it to the plugin list and buttons...
Visit Cruise Talk Central and Mr Papa's World
Did everything as layed out - but still getting empty editor area with both methods. I believe, I have an incompatibility here in the install or need to install the table plugin new.
I'll try it first on my test site. Will take some days.
Thanks for great help!
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
Odd. The non external worked fine. Could you post your code? And the changes you made on forum - components - tinymce
Visit Cruise Talk Central and Mr Papa's World