Jump to content
WebFlake
  • 0

Get viewing member group id in custom bbcode


Guest funboss

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 funboss
Link to comment
Share on other sites

Recommended Posts

  • 0
Guest funboss

That's no issue here. I clear the cache everytime I make alterations.

 

If a member (group id = 3) posts a message and used the bbcode, every member (no matter what group id) sees the same id number (3) because the group id of the poster is used. I don't want this. I want to show the group id of the member who is viewing the post.

 

Is it true that you viewed the same message with different member groups? Or did you post messages with different groups? The latter makes no sense since it's not what I want to achieve.

Edited by funboss
Link to comment
Share on other sites

  • 0
Guest funboss

I am stubborn. Please forgive me. You are right about the cache and I'm very grateful for your replies.

 

Permanently disabling content caching could be an issue, given our specs and amount of visitors. I can't think of another way to get the job done though.

Edited by funboss
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...