I'm trying to make a custom bbcode but I face some parsing problems and started to follow the guide more precisely. The one problem I ran into is about showing user groups different output. The guides lack information and with the examples (i.e. default.php) I still didn't manage to make it work, although I think it has to do with the functions (__construct, _buildOutput or _replaceText).
Below are two examples (in different functions, so it's not the variables). I already tried to change the position (_buildOutput or _replaceText) and the operators (===1 or ==1), for the sake of (my) stupidity.
To sum up, I'd like to know (a) how to differentiate between user groups or (b) another solution for my problem.
Question
Guest funboss
Hi there,
I'm trying to make a custom bbcode but I face some parsing problems and started to follow the guide more precisely. The one problem I ran into is about showing user groups different output. The guides lack information and with the examples (i.e. default.php) I still didn't manage to make it work, although I think it has to do with the functions (__construct, _buildOutput or _replaceText).
Below are two examples (in different functions, so it's not the variables). I already tried to change the position (_buildOutput or _replaceText) and the operators (===1 or ==1), for the sake of (my) stupidity.
To sum up, I'd like to know (a) how to differentiate between user groups or (b) another solution for my problem.
if(IPSMember::isInGroup($this->memberData,array(1,2,8))) { $txt = substr_replace( $txt, $this->_buildOutput( $content ), $this->cur_pos, (stripos( $txt, $close_tag, $this->cur_pos ) + strlen($close_tag) - $this->cur_pos) );} else { $txt = substr_replace( $txt, $this->_buildOutput( "<strong>Something else</strong>" ), $this->cur_pos, (stripos( $txt, $close_tag, $this->cur_pos ) + strlen($close_tag) - $this->cur_pos) );}if($this->memberData['member_group_id']=="1" || $this->memberData['member_group_id']=="2" || $this->memberData['member_group_id']=="8") { $output = "<div class='bbc_df'><strong>Something else</strong></div>";} else { $output = "<div class='bbc_df'>{$content}</div>";}Thanks in advance.
Greetings,
funboss
Edit: In the code above the if-statement always returns false. I returned the member variable and it seems to show the group id of the poster.
Edited by funbossLink to comment
Share on other sites
19 answers to this question
Recommended Posts