phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

bbcode in topic_description


 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
noisy
Board Member



Joined: 04 Jun 2011

Posts: 35



PostPosted: Fri Jun 17, 2011 2:48 pm 
Post subject: bbcode in topic_description

I am using this topic description mod (attachment)

I would like to activate bbcode in the topic description but i have no idea how to do it.

Anybody can help me?

It shouldnt be too hard... please....


Big thanks in advance icon_biggrin.gif



p.s. yes i understand that certain use of bbcode in the description could break the layout, this is not the case here.

p.s.2 i cannot use another more advanced topic description MOD



Topic_Description105a morpheus2matrix.txt
 Description:

Download
 Filename:  Topic_Description105a morpheus2matrix.txt
 Filesize:  9.96 KB
 Downloaded:  1828 Time(s)

Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Fri Jun 17, 2011 8:26 pm 
Post subject: Re: bbcode in topic_description

That's still kind of tricky, I'm not very familiar with the way BBCode is parsed. Maybe someone can confirm whether what I'm proposing makes sense.

In includes/functions_post.php, you'd have to add parsing for the thread description. Something like
AFTER
Code:
$topic_desc = htmlspecialchars(trim($topic_desc));


ADD
Code:
      $topic_desc = prepare_message(trim($topic_desc), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);

However that whole part you copied from the MOD would have to be moved after this to reuse the same bbcode_uid:
Code:
   // Check message
   if (!empty($message))
   {
      $bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
      $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
   }
   else if ($mode != 'delete' && $mode != 'poll_delete')
   {
      $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
   }

Also I'm not sure allowing HTML is a good idea. Depending on your config, it might be a non-issue, though. The risk is pretty much the same as in view_topic, I would assume.

Then we need the second_pass in viewforum.php. That would be
AFTER
Code:
$topic_desc = $topic_rowset[$i]['topic_desc'];


ADD
Code:
if ($bbcode_uid != '')
   {
      $topic_desc = ($board_config['allow_bbcode']) ? bbencode_second_pass($topic_desc, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $topic_desc);
   }


Maybe that's all it takes, but maybe it won't work at all and will break your pages (I'd put my money on the latter). I have yet to figure out why they even have BBCode IDs. Use at your own risk or, better yet if you know PHP, use it to figure out the actual solution. I'll be surprised if it works right away, but that's all I see for now.
Back to top
noisy
Board Member



Joined: 04 Jun 2011

Posts: 35



PostPosted: Sat Jun 18, 2011 2:51 am 
Post subject: Re: bbcode in topic_description

The first pass in functions_post.php looks like it is working fine. The code is moved after the message check, where the bbcode_uid is created.

the second pass is not working though... I will try to sort this out.

Big thanks for all your help man. Sad thing that there is no one else to provide wisdom here at this time...
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Sat Jun 18, 2011 9:44 am 
Post subject: Re: bbcode in topic_description

While we are limited on support, I like to think we're still better off than if this forum didn't exist icon_smile.gif

If you can't figure out a solution, let me know what part seems to be the problem, or if you see any clue.
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Sat Jun 18, 2011 12:43 pm 
Post subject: Re: bbcode in topic_description

Salvatos wrote:
While we are limited on support, I like to think we're still better off than if this forum didn't exist icon_smile.gif

I fully agree,

It would be nice to have a bigger pool of active "phpBB21 Gurus" though. icon_biggrin.gif

_________________
phpBB2 will never die, I hope!
Back to top
noisy
Board Member



Joined: 04 Jun 2011

Posts: 35



PostPosted: Sat Jun 18, 2011 1:45 pm 
Post subject: Re: bbcode in topic_description

Salvatos wrote:
While we are limited on support, I like to think we're still better off than if this forum didn't exist icon_smile.gif


of course it is better, no doubt about that icon_smile.gif

Salvatos wrote:
If you can't figure out a solution, let me know what part seems to be the problem, or if you see any clue.


I am not sure what part of the code is the problem but i suspect that since the topic_desc is property of the topic record (and not the post), there should be a new bbcode_uid, instead of using the same uid that is being used by the 'message'. I suspect that this is the problem of the first pass as given above.

In any case i am not good with php and i cannot understand the bbcode_uid at all and since there is no bbcode passes for anything in viewforum.php to use for guidance, i cannot figure out how to do it..

In the mean time, i found another topic description mod (complicated but validated) that allows specific bbcodes in the description. But i think that in this other mod the topic description is actually post description, property of the post, where of course bbcode_uid already exists. My topic_desc is property of the topic, not the post.

In other words this requires php knowledge that i dont have icon_smile.gif
Back to top
noisy
Board Member



Joined: 04 Jun 2011

Posts: 35



PostPosted: Sat Jun 18, 2011 3:11 pm 
Post subject: Re: bbcode in topic_description

i did it without bbcode... The solution was there in front of my eyes but i was too tired to see it.

some html in viewforum_body.tpl did what i wanted, bbcode should not be involved in this..


please moderators lock this topic, job is done.

thanks for the support icon_smile.gif
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Sat Jun 18, 2011 6:29 pm 
Post subject: Re: bbcode in topic_description

Oh, I thought you wanted it to be independent to each topic. Then yes, that is much more efficient and simple icon_smile.gif
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0590 seconds using 18 queries. (SQL 0.0096 Parse 0.0106 Other 0.0388)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo