Rourke (@rourke)

Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • @rourke

    Participant

    Thanks @casiepa, you got me on the right track.

    In the proces I must have removed $arg['teeny'] = false; somewhere. Adding that made it work.

    I now made it like this, and it works like a charm:

    /* TinyMCE configuration */
    function bbp_load_custom_config( $config = array() ) {
    	$config['tinymce'] = array( 
    		'toolbar1' => 'bold, italic, underline, strikethrough | blockquote | alignleft, aligncenter, alignright, alignjustify | bullist, numlist | undo, redo',
    		'toolbar2' => 'link, unlink | outdent, indent | removeformat',
    		'plugins'  => 'wplink'
    	);
    	$config['quicktags'] = array ('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
    	$config['teeny'] = false;
    	return $config;
    }
    add_filter('bbp_after_get_the_content_parse_args', 'bbp_load_custom_config');
    add_filter('mce_buttons', 'bbp_load_custom_config');
    
    /* TinyMCE loading external plugins */
    add_filter('mce_external_plugins', 'my_custom_plugins');
    function my_custom_plugins() {
    	// Reading directories
    	$plugins = glob(get_stylesheet_directory() . '/js/tinymce/*' , GLOB_ONLYDIR);
    
    	if(count($plugins) > 0){
    		// Get the plugin name = directory name, and the URL
    		foreach ($plugins as $plugin ) {
    			$plugin_name = pathinfo($plugin, PATHINFO_BASENAME);
    			$plugins_array[ $plugin_name ] = get_stylesheet_directory_uri() . '/js/tinymce/' . $plugin_name . '/plugin.min.js';
    		}
    	}
    
    	return $plugins_array;
    }

    The last function assumes all external plugins are in /wp-content/themes/child-theme/js/tinymce/ and loads them into TinyMCE.

    @rourke

    Participant

    get_stylesheet_directory_uri() in a var_dump() returns http://www.site.com/wp-content/themes/hueman-child so that seems to be good.

    @rourke

    Participant

    I’m not getting this to work.

    I have the following code for adding the emoticons plugin. The plugin file is located at /wp-content/themes/theme-child/js/tinymce/emoticons/plugin.min.js:

    add_filter('mce_external_plugins', 'my_custom_plugins');
    function my_custom_plugins($plugins_array) {
    	$plugins = array('emoticons'); //Add any more plugins you want to load here
    
    	//Build the response - the key is the plugin name, value is the URL to the plugin JS
    	foreach ($plugins as $plugin ) {
    		$plugins_array[ $plugin ] = get_stylesheet_directory_uri() . '/js/tinymce/' . $plugin . '/plugin.min.js';
    	}
    	return $plugins_array;
    }

    And for the buttons customization I use:

    function bbp_enable_visual_editor( $buttons = array() ) {
    	
    	$buttons['tinymce'] = array( 
    		'toolbar1' => 'bold, italic, underline, strikethrough, blockquote, alignleft, aligncenter, alignright, alignjustify, justifyfull, bullist, numlist, outdent, indent, undo, redo, link, unlink, table, fullscreen',
    		'toolbar2' => 'formatselect, fontselect, fontsizeselect, styleselect, strikethrough, outdent, indent, pastetext, removeformat, charmap, wp_more, emoticons, forecolor, wp_help,media,image', // 2nd row, if needed
    		'plugins'  => 'paste,emoticons'
    	);
    	$buttons['quicktags'] = array ('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
    	return $buttons;
    }
    add_filter('bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor');
    add_filter('mce_buttons', 'bbp_enable_visual_editor');

    It doesn’t load the visual editor, unless I remove emoticons from the plugins. I don’t see the my_custom_plugins() function doing anything. What am I doing wrong?

    @rourke

    Participant

    Actually just found the answer by looking at another plugin. There is a hook for it: mce_external_plugins.

    I had some trouble finding it, so it might be usefull for someone else.

    @rourke

    Participant

    Oops, I copy/pasted but forgot to edit the line. This is the correct one for anyone else trying to do this in the future:

    $mykeymasters = get_users( array('role' => 'bbp_keymaster') );

    @rourke

    Participant

    Ah! The difference was the bbp_keymaster instead of the keymaster. This worked for me:

    $mykeymasters = get_users( array('role' => 'keymaster') );

    Thanks Pascal! You really helped me out here 🙂

    @rourke

    Participant

    But isn’t that for the wordpress roles? Because that returns 0 users.

    The roles I’m talking about are the ones you specify at the bottom of a profile page. Forum roles. Apologies if I wasn’t specific enough.

    @rourke

    Participant

    Thanks Pascal,

    I’m actually making a shortcode to format a list of users that have the earlier mentioned roles. This shortcode will be used on a page for the front-end.

    It’s basically a list of site staff members.

    @rourke

    Participant

    Thanks guys!


    @robkk
    That’s exactly what I was looking for. It has a nice proper forum layout 🙂
    And my plugins hook on it great!

    @rourke

    Participant

    No one can help me out on this?

Viewing 10 replies - 1 through 10 (of 10 total)