Comments sidebar / BBCode fix?

Creating and modifying plugins.
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Comments sidebar / BBCode fix?

Post by clafferty »

is there a way to apply the markup BBCode formatting to the Comments sidebar content as well?

currently it only works with body, extended body, comments and html nugget.

i only use BBCode on my comments section... but in the sidebar plugin that lists the most recent comments, all the bbcode shows up unformatted.

example here -- http://www.cyberschnauzer.com

thanks!
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Ugly. I can see why you want this, and what you want.

Unfortunately, I'm not capable of fixing this immediately. I'll have to ask a few questions, first.

The bbcode plugin only applies markup for the frontend_display hook. It's possible the Recent Comments plugin just isn't calling that hook. Do any other markup plugins work?

What's the name of the plugin you're using to get the recent comments? And what version is it?

Do you have any other event plugins installed? Which ones, and in what order?

I think that'll be enough to get me started for now.
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, the problem is that strip_tags strips out all HTML that is transformed by BBCode. Plus, bbcode can be arbaged by the wordwrap()ing that occurs.

The strip_tags only allows the <br> and <img> tags to occur...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

judebert wrote: What's the name of the plugin you're using to get the recent comments? And what version is it?

Do you have any other event plugins installed? Which ones, and in what order?

I think that'll be enough to get me started for now.

the 'recent comments' plugin is this one --

Comments
Displays the last comments to your entries
Author: Garvin Hicking/Tadashi Jokagi/Judebert; version: 1.8




here is my list of events plugins, in order. all should be the latest versions.

Markup: Serendipity
Markup: Emoticate
Browser Compatibility
Spam Protector
Spartacus
My Mood
Statistics
Searches comments on quicksearch
Backup Interface ()
Markup: BBCode
Gravatar / Favatar
Markup: NL2BR
Extended properties for entries



hope this helps... i saw garvin's comment, but given my rather poor programming knowledge, i can't tell if he's saying "here's how to fix it" or
"here's why what you want is impossible."

i don't believe any other markup plugins work on the sidebar (altho i could be wrong). gravatar/favatars do seem to be applied there just like in the normal comments section, but i disabled them in the sidebar through a little CSS trickery.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Sorry for sounding a bit confusing :)

Emoticons should be translated in the sidebar, but actually all other HTML markup is stripped to avoid formatting problems on the sidebars. Thus my statement was more meant to be as "what you want to have is currently not possible, the plugin would need to be modified to suit your needs". The easiest thing would be to edit that plugin file, search for:

Code: Select all

strip_tags(...)
commands, and remove that.

So a strip_tags($entry['comment'], '<br /><img>') would bekome just $entry['comment']. You might want to try that and check the results?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

i took out all strip_tags commands in the sidebar comments plugin, to no effect.

if it's not clear... all i'm trying to do is get the comments in the sidebar to not look like this.


this is a [url="http://www.google.com"]test[/url]


in the actual comments, it doesn't look like that (as the bbcode is applied). i'd readily accept either stripping out the bbcode altogether in the sidebar, or making it actually work like it does in the normal comments section. either way would be great...

thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

In that case the line splitting seems to be causing your trouble, the wordwrap() code splits the BB markup as I indicated.

I have no time left to offer you a fix for this until next week; maybe judbert will join in on the weekend...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

i tried taking out all the wordwrap code as well (at least as best as i could, given what i know). it did make it so long lines like the BBCode don't break and now stretch out past the margins... but the code still exists (i.e., it still displays as [url="..."]).

thanks for the quick reply... and have a great weekend. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, could you tell me your URL or tell me what exact comment you entered to get this display?

I'll then try to reproduce this on my page and see how to work around that somehow.

...after some time...

Oh boy, I think that just your user entered wrong BBCode. Instead of:

The format \[url="http:..."] is invalid. It should read \[url=http://] instead, wihtout the quotes. This is also explained in the docs of BBCode; no Quotes shall be expected there, since it really disturbs the parser. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

i took out the quotes... still no dice. i just added a new test comment for you to look at.

"this is a [url=http://www.test.com]test[/url] comment" is the content.

thanks!

http://www.cyberschnauzer.com/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Could you please try this updated plugin file:

http://nopaste.php-q.net/227841

Replace your serendipity_plugin_comments.php file with that. It seems to work on my installation...?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

garvinhicking wrote:Hi!

Could you please try this updated plugin file:

http://nopaste.php-q.net/227841

Replace your serendipity_plugin_comments.php file with that. It seems to work on my installation...?
that completely worked! thanks!

i suppose the question then is why it wasn't working before... i have the latest serendipity installed and had updated the plugin to the latest version (through the spartacus interface).

thanks again. :)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Sorry, Garvin; I may not be having the heat troubles you are, but I'm sweating myself to death trying to finish my electric car. I want to use it to drive the kids to school on their first day.

I have decided I officially have too many projects. I think I'll elminate sleeping. That'll be a big help. Loads of wasted time, there.
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes indeed, sleeping is a terrible, unproductive timekiller! ;)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
clafferty
Regular
Posts: 43
Joined: Tue Jul 18, 2006 8:47 pm

Post by clafferty »

*sigh*

the 1.9 version of the plugin seemed to work -- however it only appears to parse the first bbcode tag.

"update:
http://myspace.com/coreylafferty
http://myspace.com/actofbetrayal"

that will show the first as a link, but lists the [url] tags in the second one. i've played around with it a bit, and found some odd behavior...

if i remove the word 'update:' from the beginning, both links show up, regardless of how high i set "Maximum chars per comment"

if i change the "wordwrap" number from 30 to 60, both links show up. however, if i move it further up to 80, it goes back to only doing the first one.

currently i'm leaving it at 60...
Post Reply