Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 10 years ago

#1874 closed defect (bug) (fixed)

Ignore img tags with class="bbcode_smiley" and leave it as plain text

Reported by: sadr's profile Sadr Owned by:
Milestone: 2.3 Priority: low
Severity: minor Version: 2.0
Component: API - Importers Keywords:
Cc: Sadr, stephen@…

Description

Every smiley on our old BuddyPress forum has been imported to bbPress 2 as an image tag instead of a plain smiley face to be re-rendered by bbPress 2.

E.g.

<img src="smileys/smile.gif" width="" height="" alt=":)" title=":)" class="bbcode_smiley" />

If possible, it'd be great if these were ignored by the importer and left as plain text.

Attachments (3)

bbPress1.php (16.1 KB) - added by netweb 10 years ago.
1874.diff (2.1 KB) - added by netweb 10 years ago.
1874.2.diff (851 bytes) - added by johnjamesjacoby 10 years ago.

Download all attachments as: .zip

Change History (11)

#1 @Sadr
11 years ago

I tried going into options-writing.php and uncheck "Convert emoticons like :-) and :-P to graphics on display" before the forum import, but that didn't do the trick either. Seems the importer just makes images out of the emoticons regardless, but it doesn't do it successfully.

#2 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to 2.2

Smilies in bbPress 1.x were hardcoded into a path, and in WordPress they are in a new path.

This will have to wait for 2.2, as it's late in 2.1 to stall the release to fix this.

A simple find/replace on the database after the conversion is complete should be good enough to get by.

#3 @netweb
11 years ago

  • Cc stephen@… added

#4 @netweb
10 years ago

Note: I will upload a patch in the next few days once I have all the importers individual settings confirmed.

Fix: Use the following 'nbbc' variables:

$bbcode->enable_smileys = false;
$bbcode->smiley_regex   = false;

Result: All smilies are imported in the same format as the original format eg. :) and honour the WordPress setting "Convert emoticons like :-) and :-P to graphics on display" 'Checked/Unchecked setting to determine if smiles are rendered using included smilies in the WordPress folder /wp-includes/images/smilies/ or not.

Caveat: Some additional <br> elements are added if needed as part of the HTML parsing in NBBC.

Original BuddyPress layout via wp_bb_posts.post_text

:D
:-D
:grin:
:)
...
:mrgreen:
:geek:
:ugeek:

After import layout in bbPress via wp_posts.post_content

note: "Convert emoticons..." setting wp-admin/options-writing.php = DISABLED

:D<br>
:-D<br>
:grin:<br>
:)<br>
...
:mrgreen:<br>
:geek:<br>
:ugeek:

After import layout in bbPress via wp_posts.post_content

note: "Convert emoticons..." setting wp-admin/options-writing.php = ENABLED

<img src="http://example.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley"> <br> 
<img src="http://example.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":-D" class="wp-smiley"> <br>
<img src="http://example.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":grin:" class="wp-smiley"> <br>
<img src="http://example.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"> <br>
... 
<img src="http://example.com/wp-includes/images/smilies/icon_mrgreen.gif" alt=":mrgreen:" class="wp-smiley"> <br>
:geek:<br>
:ugeek:

@netweb
10 years ago

#5 @netweb
10 years ago

Introduce custom callback for converters:

  • Can now use to html_entity_decode with preg_replace any custom HTML from existing topics and replies.
  • Variables can now be parsed for parser.php adding custom options to the parser as the import is processed.

@netweb
10 years ago

#6 @johnjamesjacoby
10 years ago

Cleaned up the patch, and I don't think it actually does anything?

#7 @netweb
10 years ago

Here is the full database table and output HTML before and afters using 1874.2.diff patch:

Importing bbPress 1.2 with bbPress1.php converter using existing default parser.php variable:-

enable_smileys = true;
smiley_regex = false;

Backend raw database table before import via bb_posts.post_text

:D

Frontend HTML Output

<img src="smileys/bigsmile.gif" width="" height="" alt=":-D" title=":-D" class="bbcode_smiley">

Backend raw database table after import via wp_posts.post_content

<img src="smileys/bigsmile.gif" width="" height="" alt=":D" title=":D" class="bbcode_smiley" />

Importing bbPress1.2 with bbPress1.php converter using 1874.2.diff:-

enable_smileys = false;
smiley_regex   = false;

Backend raw database table after import via wp_posts.post_content

:D

Frontend HTML Output

<img src="http://example.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley">

Importing BuddyPress 1.6x with bbPress1.php converter using existing default parser.php variable:-

enable_smileys = true;
smiley_regex = false;

Backend raw database table before import via wp_bb_posts.post_text

:D

Frontend HTML Output

<img src="smileys/bigsmile.gif" width="" height="" alt=":-D" title=":-D" class="bbcode_smiley">

Backend raw database after import table wp_posts.post_content

<img src="smileys/bigsmile.gif" width="" height="" alt=":D" title=":D" class="bbcode_smiley" />

Importing BuddyPress 1.6x with bbPress1.php converter using 1874.2.diff:-

enable_smileys = false;
smiley_regex   = false;

Backend raw database table 'after import via wp_posts.post_content

:D

Frontend HTML Output

<img src="http://example.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley">

#8 @johnjamesjacoby
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4638]) Don't parse smilies in bbPress 1.x converter. Props netweb for testing. Fixes #1874.

Note: See TracTickets for help on using tickets.