I had made a plugin for TinyMCE and insert the plugin manualy in the TinyMCE folder, but I want to do it with a wp-plugin. There for I have write the following code:
/********************************************************/
/* Function: dam_add_button */
/********************************************************/
function dam_add_button() {
// Don't bother doing this stuff if the current user lacks permissions
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
return;
// Add only in Rich Editor mode
if ( get_user_option('rich_editing') == 'true') {
add_filter('mce_external_plugins', 'dam_insert_plugin');
add_filter('mce_buttons', 'dam_register_button');
}
}
/********************************************************/
/* Function: dam_register_button */
/********************************************************/
function dam_register_button($buttons) {
array_push($buttons, 'separator', 'dam');
return $buttons;
}
/********************************************************/
/* Function: dam_insert_plugin */
/********************************************************/
function dam_insert_plugin($plugin_array) {
$plugin_array['dam'] = WP_PLUGIN_URL.'dam/editor_plugin.js';
return $plugin_array;
}
/********************************************************/
/* decalaration of the WordPress action/filter hooks: */
/********************************************************/
add_action('init', 'dam_add_button');
But when I run this code as a plugin I don't see a button at all. Can someone help me with this problem?
(I have the TinyMCE plugin placed in the plugin folder: "wp-content/plugins/dambord/dam/editor_plugin.js")
Martin