![]() |
How do I stop parsing of BB code?
Right now on my current version I hacked it so function handle_bbcode_img($bbcode, $dobbimagecode) does not work unless you are a certain user group, to stop trolls.
Now with 3.5 this is gone. I can't update until I find where this code is now. What file is the parsing of the IMG tag in now??????? |
class_bbcode
|
You should be able to use a plugin to achieve what you want.
|
How would I use a plugin to do that? I'm not very technical.
I looked throughout class_bbcode and I can't see a clear cut function that does it. Can someone point me to which function in that file handles the parsing of the IMG tag or explain how to setup a plugin to do what I need. |
File class_bbcode.php, around line 1714:
PHP Code:
|
Great! Thanks very much.
|
Wait. Thats not the best method. (modifying code when you dont have to is baaad :))
plugin bbcode_parse_start, PHP Code:
|
I didn't say that it's a best method. I just pointed at a location. As for your method, which is definitely better, the most error-proof solution would be simply:
PHP Code:
The easiest to use modify code would be: PHP Code:
;) |
It is unnecessary to use multiple is_member_of calls. You can pass an array of usergroupids.
|
Really? I didn't know. Thanks for pointing that out :) It's not really an "array", though. Rather an expanded list of parameters.
Code:
if(!is_member_of($this->registry->userinfo, X, Y, Z)) |
Quote:
|
So I am lost guys with these plugins. What should the hook location of this plugin be?
Will this not parse images unless they are usergroup X Y Z? Does this code work for sure? if(!is_member_of($this->registry->userinfo, X, Y, Z)) { $dobbimagecode = false; } |
The code Psionic posted assumes you've set your forums up to always allow bbcode and you only want to disable it for users that are in a specific usergroup. IIRC your requirement was the other way around.
The foreach loop is also useless since it is unnecessary to use a foreach loop (one already exists in is_member_of). The best way, is to either use the code i posted (which will disable all img codes for everyone except special users in a specific usergroup - regardless of the settings of the forum) PHP Code:
PHP Code:
|
That doesn't do what I wanted.
Let me try to clarify myself better. The problem I have are users signing up and then posting pornography. So I set it up so you get promoted after 30 days and 50 posts. What I need is a plugin that does not allow the parsing of a certain user group's IMG tags site and user group wide. So if user group 1 posts an IMG tag, it won't parse for any user group, it will just show up as a link. Make sense? |
My mistake.
PHP Code:
|
That doesn't work either. That just doesn't parse the IMG tag for whatever usergroup I put in there but all the other user groups the IMG tag parses for which I don't want.
I need a check that per post does this for all user groups: Is this poster part of the user group listed as not able to use IMG tags? If so then do not allow their IMG tags to be parsed for ANY user group. Right now if a user signs up they can post porn which they can't see but everyone else can. |
Ah.
Gotta look for more hooks, will get back to you :) |
Thanks for all the help Merk I really do appreciate it!
|
For the life of my I cant work out how to do it without hacking code. I hate hacking code :ninja:
Hrm. Damnit. Cant find a way in without hacking. Oh well, best way I can think of: Inside class_postbit.php, replace function parse_bbcode() with PHP Code:
PHP Code:
|
Quote:
Parse error: parse error in /home/httpd/vhosts/jeepforum.com/httpdocs/forum/includes/class_postbit.php on line 799 Fatal error: Cannot instantiate non-existent class: vb_bbcodeparser in /home/httpd/vhosts/jeepforum.com/httpdocs/forum/showthread.php on line 982 |
Can you paste the code around 799 in class_postbit.php?
Nm, parse_bbcode() has a typo. PHP Code:
|
Nope:
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /home/httpd/vhosts/jeepforum.com/httpdocs/forum/includes/class_postbit.php on line 812 Fatal error: Cannot instantiate non-existent class: vb_bbcodeparser in /home/httpd/vhosts/jeepforum.com/httpdocs/forum/showthread.php on line 982 I am replacing the first parse_bbcode: function parse_bbcode() { $this->post['message'] = $this->bbcode_parser->parse($this->post['pagetext'], $this->forum['forumid'], $this->post['allowsmilie']); } .... There is also .... function parse_bbcode() { $this->bbcode_parser->attachments =& $this->post['attachments']; $this->bbcode_parser->unsetattach = true; $this->post['message'] = $this->bbcode_parser->parse( $this->post['pagetext'], $this->forum['forumid'], $this->post['allowsmilie'], false, $this->post['pagetext_html'], $this->post['hasimages'], $this->cachable ); $this->post_cache =& $this->bbcode_parser->cached; } |
Quote:
|
Did you replace it with the code i pasted with the fixed typo?
|
Yes I did ...
|
Interesting, you were replacing the entire function as well?
The second function belongs to a seperate class, so dont worry about that one. Can you paste what you've done with 3 or 4 lines either side? |
Yes I copied and pasted your function over parse_bbcode() the orginal. That error comes out when viewing a thread.
Have you tested the code? |
No, but the error you are getting indicates a typo/error in pasting :\
You're running PHP5? |
PHP 4.3
I am guessing that code just doesn't work for some reason if you haven't tested it. Are you sure if(is_member_of($this->post, X)) works in a PHP file? That variable works in plugins but in PHP files? |
Its available everywhere. Ill look into it furthur after the xmas stuff is over :)
|
Anyone see why it's erroring out?
Quote:
What tag can I put in this function and where to stop parsing of IMG tags if the poster is a user group id 1? I tried just displaying the user group id but couldn't even find the tag to do that would work. |
Did anyone ever figure out a way to do this??? I tried creating a plugin that does this, but it seems that a member has figure out a way around it. Was trying to avoid doing a code hack, but it might be the only solution....
My plugin used the following hooks: editpost_update_start newreply_post_start newthread_post_start all 3 places have the following code in them: Code:
if (!in_array($vbulletin->userinfo['usergroupid'], array(x,y,z))) Does anyone know what other place I might need to put this code in or see any errors in my code? I figure if we can catch the issue before the post is saved, this will prevent images from being posted. Thanks for the help.... Dr00pY |
All times are GMT. The time now is 06:13 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|