The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Wrong Datatype in bbcode_class file
Okay, so I'm trying to work the usergroup smilies hack to be more secure by replacing the smilies with text instead of the image if the smilie is in a particular category (102) and the user is not in the secondary usergroup (44).
I've tried the below, and I'm getting an error for "wrong data type in second argument" Any ideas? Code:
// ##### START HACK - Usergroup Smilies ##### if ($smilie['imagecategoryid'] == "102") { if (in_array("44", $this->registry->userinfo['membergroupids'])) { if ($this->is_wysiwyg()) { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />"; } else { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />"; } } else { $replace = "*censored_smilie*"; } } else { // ##### END HACK - Usergroup Smilies ##### // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers! if ($this->is_wysiwyg()) { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />"; } else { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />"; } // ##### START HACK - Usergroup Smilies ##### } // ##### END HACK - Usergroup Smilies ##### $sc["$find"] = $replace; Thanks so much for any help |
#2
|
|||
|
|||
You don't point us to the line where you are getting this error, so i am just guessing here. I think (not checked) that $this->registry->userinfo['membergroupids'] is not an array, but a comma seperated list. Also $this will only work inside classes.
|
#3
|
|||
|
|||
membergroupids is indeed just a comma seperated list. Use is_member_of (thats whats causing the message too, as Marco pointed out)
|
#4
|
|||
|
|||
Sorry
It's in the class_bbcode.php file. So $this should work. I'm adding this on line around 452. So I tried a strpos Code:
// ##### START HACK - Usergroup Smilies ##### if ($smilie['imagecategoryid'] == "102") { $groupids = $this->registry->userinfo['membergroupids']; $allowedgroup = "44"; $pos = strpos($groupids, $allowedgroup); if ($pos === false) { $replace = "*Censored Smilies*"; } } else { // ##### END HACK - Usergroup Smilies ##### // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers! if ($this->is_wysiwyg()) { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />"; } else { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />"; } // ##### START HACK - Usergroup Smilies ##### } // ##### END HACK - Usergroup Smilies ##### The one I'm testing it with is smilie id 867, the smilie it shows is 866 LOL Any clues where else I might need to look? Thanks tons for help with the array problem W00t! Got it working with this code Code:
// ##### START HACK - Usergroup Smilies ##### if ($smilie['imagecategoryid'] == "102") { $groupids = $this->registry->userinfo['membergroupids']; $allowedgroup = "150"; $pos = strpos($groupids, $allowedgroup); if ($pos === false) { $replace = "*Censored Smilies*"; } else { if ($this->is_wysiwyg()) { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />"; } else { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />"; } } } else { // ##### END HACK - Usergroup Smilies ##### // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers! if ($this->is_wysiwyg()) { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />"; } else { $replace = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />"; } // ##### START HACK - Usergroup Smilies ##### } // ##### END HACK - Usergroup Smilies ##### |
#5
|
|||
|
|||
You should use the function is_member_of.
|
#6
|
|||
|
|||
Can I use is_member_of in a php file? I thought it was a template conditional only.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|