Hansaplastique (@hansaplastique)

Forum Replies Created

Viewing 11 replies - 26 through 36 (of 36 total)
  • @hansaplastique

    Participant

    Oh you of course will need CodeColorer plugin installed …

    @hansaplastique

    Participant

    Never mind; figured it out (by coincidence).

    If anyone is interested, add the following code to your wordpress functions.php;

    function t4a_bbp_shortcodes( $content, $reply_id ) {
    	return codecolorer_highlight( $content );
    }
    add_filter('bbp_get_reply_content', 't4a_bbp_shortcodes', 10, 2);
    add_filter('bbp_get_topic_content', 't4a_bbp_shortcodes', 10, 2);

    @hansaplastique

    Participant

    I have no idea – it seems that this is a tinyMCE plugin?
    I haven’t played with 3rd party tinyMCE plugins yet – but if you tell me how to install it, then I wouldn’t mind testing it for you.

    Bottomline is that you’ll have to look for the “keyword” to get the button to become visible (in this case “preview” according to this link). Add that keyword to the “array_push” list.

    One plugin I use (WP Smileys) requires that I make a few minor modifications;

    In functions.php (in the code above, just below “add_filter(‘mce_buttons_2’, ‘add_tinymce_buttons_2’);”), I had to add:

    // Restore the smileys plugin
    add_filter(“mce_external_plugins”, “s4w_tinymce_addplugin”);
    add_filter(‘mce_buttons’, ‘s4w_tinymce_registerbutton’);

    @hansaplastique

    Participant

    I guess the code formatting didn’t work again … wish I could edit.

    @hansaplastique

    Participant

    Thanks Stephen – and here I thought the “code” button would do that for me 😉
    I’ll paste the code again, as you can see I removed some buttons (that have no purpose anyway) and added some …


    add_filter('tiny_mce_before_init', 'tinymce_other_css_for_content');

    function bbp_mce_override( $args = array() ) {
    $args['teeny'] = false;
    return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_mce_override' );

    if (!is_super_admin()) // remove/add buttons for non admins
    {
    function add_tinymce_buttons($buttons)
    {
    $arr_size=count($buttons);
    $remove_these=array('blockquote','wp_adv','fullscreen','wp_more');

    for ($counter=$arr_size; $counter>=0; $counter--)
    {
    if ( in_array($buttons[$counter],$remove_these) )
    {
    unset($buttons[$counter]);
    }
    }

    array_push($buttons,'separator','cut','copy','paste','separator','undo','redo','separator','sub','sup','forecolor','backcolor','charmap');

    return $buttons;
    }

    function add_tinymce_buttons_2($buttons)
    {
    unset($buttons);
    return $buttons;
    }

    add_filter('mce_buttons', 'add_tinymce_buttons');
    add_filter('mce_buttons_2', 'add_tinymce_buttons_2');
    }

    For some of these to work I had to expand the allowed_tags in WordPress (be carefull when doing this) using the following code;


    function my_allowed_html_tags_in_comments() {
    define('CUSTOM_TAGS', true);
    global $allowedtags;

    $allowedtags = array(
    'a' => array(
    'href' => array (),
    'title' => array ()),
    'blockquote' => array(
    'cite' => array ()),
    'cite' => array (),
    'code' => array(),
    'em' => array(),
    'strong' => array(),
    'pre' => array(
    'class' => array()),
    'p' => array(
    'style' => array()),
    'span' => array(
    'style' => array()),
    'sup' => array(),
    'sub' => array()
    );
    }

    add_action('init', 'my_allowed_html_tags_in_comments', 10);

    Hope it’s helpful to someone 🙂

    @hansaplastique

    Participant

    If anyone can tell me how to properly post code I’ll try again. 🙁

    @hansaplastique

    Participant

    Sorry that the code looks a little messy, the code-tag didn’t do a very good job at keeping the indentation and there is no edit button …. hmmm.
    I’ll just give it another try.


    function bbp_mce_override( $args = array() ) {
    $args['teeny'] = false;
    return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_mce_override' );

    if (!is_super_admin()) // remove buttons for non admins
    {
    function add_tinymce_buttons($buttons)
    {
    $arr_size=count($buttons);
    $remove_these=array('blockquote','wp_adv','fullscreen','wp_more');

    for ($counter=$arr_size; $counter>=0; $counter--)
    {
    if ( in_array($buttons[$counter],$remove_these) )
    {
    unset($buttons[$counter]);
    }
    }

    array_push($buttons,'image');

    return $buttons;
    }

    function add_tinymce_buttons_2($buttons)
    {
    unset($buttons);
    return $buttons;
    }

    add_filter('mce_buttons', 'add_tinymce_buttons');
    add_filter('mce_buttons_2', 'add_tinymce_buttons_2');
    }

    @hansaplastique

    Participant

    I’ve used the following code to remove some buttons for non-admins.
    This will keep your normal editor in the admin pages as they should stay, yet visitors of my bbPress forum can only use a few buttons.
    You can find a list of “standard” buttons in tinyMCE here.

    Place this code in the functions.php file of your theme.
    (ps. I’m no expert and pretty new to bbPress – but this worked like a charm for me)

    function bbp_mce_override( $args = array() ) {
    $args['teeny'] = false;
    return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_mce_override' );

    // *********************** CUSTOMIZE TINYMCE BUTTONS FOR BBPRESS *****************************
    if (!is_super_admin()) // remove buttons for non admins
    {
    function add_tinymce_buttons($buttons)
    {
    $arr_size=count($buttons);
    // remove blockquote, kitchen-sink, full-screen and the more-button
    $remove_these=array('blockquote','wp_adv','fullscreen','wp_more');

    for ($counter=$arr_size; $counter>=0; $counter--)
    {
    if ( in_array($buttons[$counter],$remove_these) )
    {
    unset($buttons[$counter]);
    }
    }

    // add the "image" button
    array_push($buttons,'image');

    return $buttons;
    }

    // Erase the entire 2nd button bar
    function add_tinymce_buttons_2($buttons)
    {
    unset($buttons);
    return $buttons;
    }

    add_filter('mce_buttons', 'add_tinymce_buttons');
    add_filter('mce_buttons_2', 'add_tinymce_buttons_2');
    }

    @hansaplastique

    Participant

    I’m no expert (and pretty new to bbPress), but this is how I forced tinyMCE for bbPress 2.2.3 to use my stylesheet for content.

    You’ll need a CCS file with your preferences of course, and add the following code to functions.php found in the root of your theme – in my case I’m using the CSS of my theme.
    This will also apply the selected CSS to the editor in your admin pages (for Posts etc).

    function tinymce_other_css_for_content( $init ) {
    $init['content_css'] = get_bloginfo('stylesheet_url');
    return $init;
    }

    add_filter('tiny_mce_before_init', 'tinymce_other_css_for_content');

    @hansaplastique

    Participant

    For some reason my code didn’t stick; I mean remove:

    bb_new_topic_link();

    @hansaplastique

    Participant

    +1 for me.

    I installed “bbPress Topics for Posts” (plugin link).
    I wanted to create one forum that collects comments on articles (this plugin does that very well – only downside is that comments made in the forum do not count as comments but are visible).

    Anyhow; I want users to be able to reply, but NOT create new topics.
    Right now it’s either no new topics and no new replies, OR new topics and new replies.

    Of course I could modify the forum.php and remove the for the specific forum. Is there an easier (more future proof) way?

Viewing 11 replies - 26 through 36 (of 36 total)