View Full Version : Only custom usergroups able to view html and php blocks
vze2yqtm
06-21-2015, 06:14 PM
Hi, if someone can please create a plugin to allow me to specify who can view certain blocks, I will be very grateful - thanks in advance :)
MarkFL
06-22-2015, 12:02 AM
Please take a look at this product:
Hide BBCodes/Signatures From Guests (https://vborg.vbsupport.ru/showthread.php?t=318467)
If I were to add the ability to hide BBCodes from everyone except the usergroups you specify in the product settings, would that work for you?
vze2yqtm
06-22-2015, 05:33 AM
Please take a look at this product:
Hide BBCodes/Signatures From Guests (https://vborg.vbsupport.ru/showthread.php?t=318467)
If I were to add the ability to hide BBCodes from everyone except the usergroups you specify in the product settings, would that work for you?
Thanks so much for the fast reply, Sir :) That would be a great feature, but the sidebar block I wish to only show specific usergroups is a html code
MarkFL
06-22-2015, 05:38 AM
I thought you were talking about hiding BBCodes like the CODE, HTML, and PHP blocks. If you could explain exactly what you have in mind, you would more likely be helped. Can you provide a screenshot of what it is you wish to hide?
vze2yqtm
06-22-2015, 04:27 PM
Hi, thanks so much for the help :) http://prntscr.com/7k1j21 What I wish to hide from guests is the Special Events poster on the top, which is a simple html sidebar block
MarkFL
06-22-2015, 05:47 PM
If you wish to hide just that block from guests, then I think your best bet is to change the content type to PHP, and then use a conditional to render the output. You could use the following format:
global $show;
if (!$show['guest'])
{
$output = 'HTML goes in here';
return $output;
}
vze2yqtm
06-23-2015, 02:24 PM
Thanks so much for the suggestion, Sir, but this causes a parse error
MarkFL
06-23-2015, 02:35 PM
Can you post the PHP code you have? I suspect a few single quotes need to be escaped.
vze2yqtm
06-23-2015, 02:41 PM
Parse error: syntax error, unexpected '<' in /home/*****/public_html/includes/block/html.php(95) : eval()'d code on line 12
Parse error: syntax error, unexpected '<' in /home/*****/public_html/includes/block/html.php(95) : eval()'d code on line 12
MarkFL
06-23-2015, 02:43 PM
I mean can you post the actual PHP code you have in the block, not the resulting errors.
vze2yqtm
06-23-2015, 02:52 PM
You were right, I repasted it to recreate the error and it worked, a quote was probably missing - thanks so much for your time and patience, Sir :) How would I make it visible to only admins and staff if I wished?
MarkFL
06-23-2015, 02:58 PM
If by staff you mean all those who have moderating privileges anywhere on your forum, then change the condition "!$show['guest']" to "can_moderate()". :)
vze2yqtm
06-23-2015, 03:10 PM
Thanks, you are awesome :)
TheLastSuperman
06-23-2015, 05:19 PM
Excellent display of being genuinely helpful, thanks Mark you made my day seeing this, now more coffee ;).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.