Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 20 Nov 2011, 05:15
genxstan genxstan is offline
 
Join Date: Nov 2009
Question Hide code tags from certain usergroups ?

Hi guys ,
Can someone direct me ,how to hide something written in code tags
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

for unregistered users ?
I like to hide user-group 1,3 . Since i dont know how to do it ,i just removed these Forum Viewing Permissions for unregistered user-group.
Can View Others' Threads
Can View Thread Content
Which is really hurting Google traffic .

My VB version 4.1.5

I have been reading vBulletin Template Conditionals and its not getting me anywhere.
Reply With Quote
  #2  
Old 20 Nov 2011, 06:07
nerbert nerbert is offline
 
Join Date: May 2008
$string = preg_replace(/\[code\].*\[\/code\]/i, "", $string);

I think that'll knock them out of $string. Are you good with plugins?

EDIT: Wait a minute, let me work on that some more.

EDIT2:

Here we go (I think)

$string = preg_replace(/\[code\][\s\S]*?\[\/code\]/i, "", $string);

--------------- Added 20 Nov 2011 at 06:43 ---------------

All wrong about that. What I posted would match bb code. You will need to match html for a code box


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by nerbert; 20 Nov 2011 at 06:19.
Reply With Quote
  #3  
Old 20 Nov 2011, 07:48
genxstan genxstan is offline
 
Join Date: Nov 2009
What are those things ? I have no idea where to use those ,other than adding some verification codes in header code of themes . I was used to marco hide plugin which isnt working anymore for last few months after VB 4.0.3 or something.
Reply With Quote
  #4  
Old 20 Nov 2011, 08:16
nerbert nerbert is offline
 
Join Date: May 2008
Those things with all the slashes? Those are regular expressions. They describe patterns for matching strings of characters and you can use the preg_replace function to replace one string of characters with another (or with a blank).

You'll never get anywhere with template conditionals, this has to be done at the php level. I'd work on it but I can't get a reliable connection to my server right now so I can't view any files.

Or do you mean plugins? Those are chunks of code inserted into files (well, sort of). Anyway you'll need one.
Reply With Quote
  #5  
Old 20 Nov 2011, 08:45
Liff Liff is offline
 
Join Date: Aug 2011
I would be very interested in this too, nerbert.

Thanks for taking the time to look at it.
Reply With Quote
  #6  
Old 20 Nov 2011, 09:01
genxstan genxstan is offline
 
Join Date: Nov 2009
In Style manager - Edit Templates - BB Code Layout Templates - bbcode_code

I changed default code


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Add usergroup Numbers to this
$bbuserinfo, 2,7,5,6,9 which are the ones whom i want to show the code contents like registred users,moderators etc. For others the code wont show as i have added <vb:else /> to that.


I'm testing it and i'll be looking for users complaints if they cant view threads with code.
Reply With Quote
  #7  
Old 20 Nov 2011, 09:52
nerbert nerbert is offline
 
Join Date: May 2008
Hmmm ... that might work. I'm getting close but am having a glitch.

What about PHP and HTML tags?
Reply With Quote
  #8  
Old 20 Nov 2011, 10:41
genxstan genxstan is offline
 
Join Date: Nov 2009
No idea about other tags ,i've taken note for the bbcode conditionals from this site,so i made this even though i never did that. Hope it works without bugs.
Will report back if code is problematic.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 18:20.

Layout Options | Width: Wide Color: