Here is the way if you want to hide the blocks(weather right/left/center or all) when in specific action or for specific membergroup or for specific membergroup when in some action
I wasn't sure weather it has been told before or not, but I desperately wanted it to figured a way out to do so, and just sharing it :)
This is tested and it works with SMF 1.1.x and TP 0.9.8
Where to?
First of all the file to be edited is /Sources/TPortal.php and the place where you have to add the code is before }
function TPfrontpage($type)
{
Make sure of the brackets and curly braces, It should be right before this part, at the very end of the TPortal_init() function.
How to?
Lets say, we have a Arcade and a Gallery and we want to hide all the blocks when we get in them.
Now first of all, find there actions, which can be found by there URL.(I.e. For SMFArcade it can be http://yoururl.com/index.php?action=arcade)
And the action is "arcade"(Without the quotes), so in the same way, you can find for the rest.
So Actions for Arcade and Gallery is "arcade" and "gallery"(Without the quotes).
So as said before in "Where to", find that code and add before
if(in_array($context['current_action'], array('arcade', 'gallery'))) {
tp_hidebars('all');
}
Now to understand the parts, Lets start with the "if" which is if(in_array($context['current_action'], array('arcade', 'gallery')))
$context['current_action'] is where the current action is stored, so this is the root. I used in_array so that we can find out weather the action is in $context['current_action'].
Now the ('arcade', 'gallery') are the names of the action. They must be in in single quotes ( ' ) and 2 or more must be separated by using commas
Ex ('something', 'something again', 'and something'). The rest closing brackets are to close so that it will prevent syntax errors and the starting curly brace "{" and the end one "}" in which if it gets true, the code executes inside it.
Lets see, this is true? Lets get the tp_hidebars('all') executed, which you may have guessed right, this hides the stuff.
So well this is basically what we have to do.
Some more Stuff
Even though the previous part was the main but was it enough? No? Lets continue ;)
Now that you know how to do the basics, lets get in deeper.
Here are the 4 attributes of tp_hidebars() function
tp_hidebars('center') - Hides the Center Blocks
tp_hidebars('left') - Hides the Left blocks
tp_hidebars('right') - Hides the right block and
tp_hidebars('all') - Hides all the blocks.
Lets say you want to hide the left blocks for someone in Group 9 when they are in a action named "shop"
if(in_array(9, $user_info['groups']) && in_array($context['current_action'], array('shop'))) {
tp_hidebars('left');
}
Get it? $user_info['groups'] contains its groups and 9 is the group ID, and the rest part you know.
This is how many combinations can be made.
Some well demanded variables are
$context['user']['is_guest'] - Weather the user is guest or not
$context['user']['is_admin'] - Weather the user is admin or not
$context['user']['id'] - Users ID
$context['current_action'] - Current Action as explained.
$user_info['groups'] - Contains the User's Groups
And there are many
Feel free to post any Questions or Comments in this thread
Made by Dragooon and released over at TinyPortal (http://tinyportal.co.uk) and TinyPortalMedia (http://www.tinyportalmedia.com/)
way to go man , thnx a lot ! ;)
Thanks :).
If you want the option to turn on/off in your admin panel you can follow my tutorial I posted.
http://www.tinyportal.net/index.php?topic=13031.msg108852#msg108852
There is one? :P
Didn't knew lol.
Hi...
i want to hide the blocks in the whole forum...
I successfully removed them from the forumindex, but not from the different threads and boards...
If i open for example : www.mysite.com/smf/index.php?board=5.0 , then the blocks are visible again... also if i open www.mysite.com/smf/index.php?topic=5.0 ...
Is it possible that all blocks are visible in the portal and to hide them in the whole forum???
thx
Wurst
Admin>TinyPortal>Settings>Panel> On this page each panel left/right/center have the option to show or "Not" when in the forum.
Thx!
Nice Support O0
What would be the code for hiding blocks (tp_hidebars()) in topics?
So when i click on a topic and open it, that it don't get any blocks showed?
if (isset($_GET['topic'])){
tp_hidebars();
}
Thanks man...this option should definately be added to next TP ;)
P.S.
It should be added to the snippet index, so the people don't ask the same thinkover and over. I found this topic quite difficult (was on the 4-5 page of my search)...
It is default in TP 1 ;)
Nice...hopefully it wont make problems on my, quite modded, smf
Hi,
I want to show a block only in this link:
index.php?action=gallery;cat=15
In the Option block "Choose where the block should appear" What should I include?
Thank You very much!
You can't do it that way. It can only do the action=something part.
The only work around you can do is to have the code in the block check for cat=15 to display your block code. But that would mean the block would have to be displayed as empty on other pages of the gallery. But you can then turn the option off to show the theme/title of the block.