Hansaplastique (@hansaplastique)

You are now logged out.

Forum Replies Created

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

  • Hansaplastique
    Participant

    @hansaplastique

    No worries – it was very helpful, took me only a few seconds to get it to work.
    Thank you very much again :)


    Hansaplastique
    Participant

    @hansaplastique

    Thanks Jared – I very much appreciate the link. Works like a charm! :)

    Minor issue with the code: it is missing “function” in front of the “ja_filter_bbpress_allowed_tags” definition.


    Hansaplastique
    Participant

    @hansaplastique

    Thanks Jared, I appreciate you taking the time to reply …

    My question remains how do I correctly add style or class to the allowed tags without modifying the actual formatting.php file :(


    Hansaplastique
    Participant

    @hansaplastique

    Thanks for your response Jared … I don’t mind the change, just would like to know the recommended way to change the allowed tags without having to modify the bbPress files … :)

    For example;
    I allow registered users to place smileys in their text. The smileys are IMG’s with a particular class – the class however will be removed unless I give the user unfiltered HTML.
    I trust my users, but just not THAT much :)


    Hansaplastique
    Participant

    @hansaplastique

    I’d be curious to know what the recommended technique is to add or remove allowed HTML tags as well … the recent change (not using the tags list of WP) broke my editor :(


    Hansaplastique
    Participant

    @hansaplastique

    I’ve made some good progress with TinyEditor. It’s indeed very fast and implementation has not been super complicated (so far).

    But again; mobile browsers are not the greatest browsers.

    Typing and submitting works fine on iOS. Formatting however is lost somehow.
    Kindle (Android) still claims it can’t load wp-comments-post.php.

    With both selecting text, and applying formatting is a disaster. Often the selection “hint” (Select, Select All, Copy, etc) overlaps the buttonbar of the editor.

    Note: At this moment (to keep things easy) I’m only testing this in WordPress comments. Once that works OK I’m going to try to use it for bbPress posts.


    Hansaplastique
    Participant

    @hansaplastique

    Never mind Redactor – it’s commercial.
    Great editor but it wouldn’t fit in the license model either WordPress or bbPress.


    Hansaplastique
    Participant

    @hansaplastique

    I agree; this is more something bbPress inherited from WordPress I’m assuming, since WP brings us tinyMCE. The issues at hand appear common knowledge in the tinyMCE community – and it appears that most WYSIWYG editors have similar problems.

    2 WYSIWYG editors stood out so far for me to consider doing some testings with:
    - TinyEditor (super small and very responsive)
    - Redactor (little bigger but much more functionality, yet still responsive

    As for a bug/issue ticket; where do we do that? and wouldn’t this a bug/issue for WordPress?


    Hansaplastique
    Participant

    @hansaplastique

    Android devices appear to be very slow here as well, and selecting text is a challenge – I completely agree.

    The MyTouch and the Kindle both report to be a regular Linux (Kindle) or Macintosh (I couldn’t believe it, and tested this numerous times in different ways) AppleWebKit browser – no notion of “mobile” or “Android”.

    Also on the myTouch, when pressing a button on the menubar of tinyMCE behaves very odd.

    These findings basically tell me that Fancy Editor is useless for mobile visitors (thanks for bringing it up!).

    So either we have to revert back to “just text” for mobile users or find an alternative editor that actually does behave properly.


    Hansaplastique
    Participant

    @hansaplastique

    Note: iPad (3rd gen) and iPhone (4S) work just fine.


    Hansaplastique
    Participant

    @hansaplastique

    OK, I’ve been testing Android a little more intense than before; boy that’s a drama on it’s own.

    So the first problem I noticed (T-Mobile/HTC myTouch 4G): Android does not like tinyMCE. It will let me type, but nothing appears in the editor, instead it ends up in the email input (not sure if this is a generic problem or maybe just my theme).

    Adding elements through tinyMCE plugins works but the FancyBox appears to be not working all that well.

    Submitting works – but of course none of the typed text in the message, only what I added through one of the tinyMCE plugins.

    Next I tried a Amazon Kindle Fire HD (can’t really recommend this tablet – great hardware, crappy software). Things work better here, including entering text.
    However … submitting the comment ends up in a “Webpage not available – The webpage at http:///wp-comments.php could not be loaded because: Unkown Error”.

    Is this in anyway familiar with the situation you run into?


    Hansaplastique
    Participant

    @hansaplastique

    I haven’t had any problems on smartphones,… yet … iPhone/Android; they all work fine.
    I’m sure there are other platforms (Windows,BlackBerry) but I do not know anyone who has either to test.

    What problems do you run into?
    I’d be very interested in your feedback on where it goes wrong/misbehaves (so I can adapt my website as well).
    - Does tinyMCE misbehave?
    - Or simply not work (lack of JavaScript)?

    It might be difficult to determine if a visitor uses a phone or a regular computer, specially since the gap between the two is getting more narrow by the day.

    Some examples are discussed here: Stackoverflow.
    There is an example of browser sniffing (not my favorite) and some other techniques.

    However … they all rely on JavaScript (which would be too late for doing something in PHP).

    I did find some PHP code that could do the trick here: php-mobile-detect.
    I have not tested it though.

    If a cellphone is detected call (untested):

    bbp_the_content( array( ‘context’ => ‘reply’, ‘tinymce’ => false ) );


    Hansaplastique
    Participant

    @hansaplastique

    Oh you of course will need CodeColorer plugin installed …


    Hansaplastique
    Participant

    @hansaplastique

    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

    @hansaplastique

    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

    @hansaplastique

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


    Hansaplastique
    Participant

    @hansaplastique

    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

    @hansaplastique

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


    Hansaplastique
    Participant

    @hansaplastique

    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

    @hansaplastique

    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

    @hansaplastique

    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

    @hansaplastique

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

    bb_new_topic_link();


    Hansaplastique
    Participant

    @hansaplastique

    +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 23 replies - 1 through 23 (of 23 total)