Skip to:
Content
Pages
Categories
Search
Top
Bottom

Emoticons For bbPress?

  • Hi,

    Maybe it’s just me but it would be great if emoticons (just like WP) were included in bbPress. Without using a plugin. I’m thinking about making a simple plugin that would work, or at least hope to work. :-)

Viewing 25 replies - 1 through 25 (of 81 total)
  • Anyone?

    It’s a good idea, I’m sure it’ll happen. Be patient!

    OK…

    I wanted that functionality as well so I ripped some WP code, played around, and finally got something I could use. This is a highly sloppy work as I am out of practice and not really a great PHP programmer anyway. The plugin is mostly a rip of the WordPress code with a filter. It is not elegant or tested completely but so far it has been getting the job done.

    Note: This plugin will not work without a default install of WordPress.

    You have to create a directory called /my-plugins/, copy this code into a file called whatever-you-want.php, upload and enjoy!

    Feedback appreciated! Maybe I can improve on this and increase my PHP/*press skills. ;)

    <?php

    /*

    Plugin Name: WordPress Smiley Integrator .0002

    Plugin URI: none

    Description: Gives WordPress Smiley Functionality to bbPress

    Author: John Farrell

    Version: 1.0

    Author URI: none

    */

    function convert_smilies($text) {

    $wpsmiliestrans = array(

    ':mrgreen:' => 'icon_mrgreen.gif',

    ':neutral:' => 'icon_neutral.gif',

    ':twisted:' => 'icon_twisted.gif',

    ':arrow:' => 'icon_arrow.gif',

    ':shock:' => 'icon_eek.gif',

    ':smile:' => 'icon_smile.gif',

    ' :???:' => 'icon_confused.gif',

    ':cool:' => 'icon_cool.gif',

    ':evil:' => 'icon_evil.gif',

    ':grin:' => 'icon_biggrin.gif',

    ':idea:' => 'icon_idea.gif',

    ':oops:' => 'icon_redface.gif',

    ':razz:' => 'icon_razz.gif',

    ':roll:' => 'icon_rolleyes.gif',

    ':wink:' => 'icon_wink.gif',

    ':cry:' => 'icon_cry.gif',

    ':eek:' => 'icon_surprised.gif',

    ':lol:' => 'icon_lol.gif',

    ':mad:' => 'icon_mad.gif',

    ':sad:' => 'icon_sad.gif',

    '8-)' => 'icon_cool.gif',

    '8-O' => 'icon_eek.gif',

    ':-(' => 'icon_sad.gif',

    ':-)' => 'icon_smile.gif',

    ':-?' => 'icon_confused.gif',

    ':-D' => 'icon_biggrin.gif',

    ':-P' => 'icon_razz.gif',

    ':-o' => 'icon_surprised.gif',

    ':-x' => 'icon_mad.gif',

    ':-|' => 'icon_neutral.gif',

    ';-)' => 'icon_wink.gif',

    '8)' => 'icon_cool.gif',

    '8O' => 'icon_eek.gif',

    ':(' => 'icon_sad.gif',

    ':)' => 'icon_smile.gif',

    ':?' => 'icon_confused.gif',

    ':D' => 'icon_biggrin.gif',

    ':P' => 'icon_razz.gif',

    ':o' => 'icon_surprised.gif',

    ':x' => 'icon_mad.gif',

    ':|' => 'icon_neutral.gif',

    ';)' => 'icon_wink.gif',

    ':!:' => 'icon_exclaim.gif',

    ':?:' => 'icon_question.gif',

    );

    // generates smilies' search & replace arrays

    foreach($wpsmiliestrans as $smiley => $img) {

    $wp_smiliessearch[] = $smiley;

    $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);

    $wp_smiliesreplace[] = " <img src='/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";

    }

    $output = '';

    // HTML loop taken from texturize function, could possible be consolidated

    $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between

    $stop = count($textarr);// loop stuff

    for ($i = 0; $i < $stop; $i++) {

    $content = $textarr[$i];

    if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag

    $content = str_replace($wp_smiliessearch, $wp_smiliesreplace, $content);

    }

    $output .= $content;

    }

    return $output;

    }

    //add the filter

    add_filter('post_text', 'convert_smilies');

    ?>

    i think first thing to be changed should be the src .

    src=’http://www.cfv88.com/wp-includes/images/smilies/$img’ alt=’$smiley_masked’ class=’wp-smiley’ /> “;

    to make it something related to the forum and not on external links …

    you could make a new folder called image where all images are inside … and fix the url …

    Oops, removed my site specific urls.

    Well, the point of the entire plugin is to integrated with WordPress. I wouldn’t want to have my smiley images stored in two different locations and I’m not entirely sure were to edit my default WP smiley locations.

    i’m a total newbie in bbpress … but in wordpress you could use instead of the url .. the blog url example :

    get_settings(‘siteurl’);

    to get the blog url …

    I tried the same code as above but it did not work for me. I’m not sure if htere is a get_settings in BBpress but, you can use $_SERVER;

    What exactly did not work?

    bb-emotions plugin

    A friend of mine, Japanese bbPress user enjoy hacking plugin WP Grins port to bbPress.

    So, he wants to add this bb-emotion here, but he’s not good at english, then I translate he says.

    = = = =

    ziped code:

    http://prdownloads.sourceforge.jp/wppluginsj/22267/bbEmoticons-0.72.zip

    1. put bb-emotions.php to /my-plugins/ ;
    2. put smilies folder into /bb-images/;
    3. add <?php bb_do_action('bb_grins'); ?> to above the textarea in the each theme (edit-form.php, post-form.php);

    That’s all, and does work!

    I’m so happy if this will be your help :)

    = = = = =

    Thank you.

    thanks.

    this worked right out of the box.

    FYI, when installing this you should, if you havnt already, copy the edit-form.php and post-form.php to “my-templates” before you edit them.

    Hopefully we can find someone to help with a bbPress version of “comment quicktags”.

    Great job. Dropped right in, went right to work.

    Thanks!

    not working.. i m sure its my problem, cause i know only HTML but not PHP.

    anyone can tell me exactly where to put “<?php bb_do_action(‘bb_grins’); ?> ” ??

    thanks a lot

    open /bb-templates/post-form.php

    add that line here

    ‘<?php endif; do_action( ‘post_form_pre_post’ ); ?>

    <?php bb_do_action(‘bb_grins’); ?>

    <label for=”post_content”><?php _e(‘Post:’); ?>

    <textarea name=”post_content” cols=”50″ rows=”8″ id=”post_content” tabindex=”3″></textarea>

    </label>

    HTH


    AphelionZ
    Member

    @aphelionz

    n22 – in your forums folder there’s a folder called bb-templates. make a new folder called my-templates and copy these files from bb to my template folder – edit-form.php, post-form.php

    Edit those files – find the only instance of textarea in them and put that php code (just copy and paste, it’s ok!) in a reasonable spot nearby. For example, they said above, but i chose below because i thought it worked better. All depends on the template.

    PS – GREAT JOB! It worked perfectly for me

    THANK YOU ļ¼šfuknrekd and AphelionZ

    ill try it!

    hahahaha !!!!!!!!! it works!@!!!! Thanks to all!!


    peiqinglong
    Member

    @peiqinglong

    Cool! Works for me also!

    quick note

    i had to add this line to my header.php file

    <script type="text/javascript" src="'. bb_get_option('uri') .

    'my-plugins/bb-emoticons.php?bb_grins_output=javascript"></script>

    add that to the steps to get this to work if you are having troubles with clicking on the icons not working

    Hope that this feature gets added to the package soon :-)

    just a thought anyone want to modify this plugin so that you can add icons to titles

    to tekhawk

    why they cannot work with my bbpress when clicking on the icons ?

    i add the sentence

    yeeeeeeeeeeeha!

    thanks a lot! great work!!!

    FYI: After upgrading to 0.74, my bbEmoticon images were broken.

    I changed paths in bb-emoticons.php to get them working again:

    “bb-images/smilies” to “../bb-images/smilies”

    eek, I take that back, it breaks again when editing a post.

    I hardcoded my install path because I couldn’t find the function name for the home install.


    chrishajer
    Participant

    @chrishajer

    Is anyone using this with .80?

Viewing 25 replies - 1 through 25 (of 81 total)

You must be logged in to reply to this topic.