Log in

View Full Version : Disable spoiler bbcode in signatures


jscieza
01-04-2011, 12:47 PM
Hi,

I like many others forum owners have implemented a spoiler bbcode in my forums. Now I want to globally (for all usergroups) disable the use of the spoiler bbcode in signatures.

Is that an easy task? Any ideas?

Thank you,
Jonathan



EDIT: I have been investigating and found this from a member:

To disable custom bbcodes in the signature add this hook bbcode_parse_start:

if ($forumid==='signature')
{
unset($this->tag_list['no_option']['bbcode_to_disable']);
}


However if I do that, my spoiler bbcode stop working on posts too. Can anyone give me a hand with the conditional please? Thank you.

kh99
01-04-2011, 02:43 PM
I think maybe the problem is that the same bbcode parser object is used for all posts and signatures, so once that variable is unset for the first signature it can't process any spoiler tags in following posts. That's probably why some people though it worked and some didn't - they probably were using different test cases.

I don't know what a good solution is off the top of my head. I guess you could save it somewhere before unsetting it, then put it back when needed, like:

if ($forumid==='signature')
{
if (!empty($this->tag_list['no_option']['bbcode_to_disable']))
{
$this->tag_list['save']['bbcode_to_disable'] = $this->tag_list['no_option']['bbcode_to_disable'];
unset($this->tag_list['no_option']['bbcode_to_disable']);
}
}
else
{
if (empty($this->tag_list['no_option']['bbcode_to_disable']))
{
$this->tag_list['no_option']['bbcode_to_disable'] = $this->tag_list['save']['bbcode_to_disable'];
}
}


(I haven't tried this code at all)

jscieza
01-04-2011, 04:33 PM
Hi kh99,

Thanks for your reply and coding help.

I have tried with the code you made and unfortunately it isn't working. It also produces these errors:

Parse error: syntax error, unexpected '{' in public_html/includes/class_bbcode.php(360) : eval()'d code on line 4

Unable to add cookies, header already sent.
File: /home/uxbmsp/public_html/includes/class_bbcode.php(360) : eval()'d code
Line: 4

:(

kh99
01-04-2011, 04:36 PM
Oh, sorry - that's what happens when I post code without trying it at all :o

I fixed it (or, at least the syntax errors).

jscieza
01-04-2011, 04:44 PM
It works!

Thank you very much!!! :up: