TinyPortal
Development => Block Codes => Topic started by: reaper2120 on June 29, 2006, 07:48:06 PM
I have a content block like the one here on this site. It contains links for the members of our clan, links for visitors, and general use links so i cant make it viewable to a specific group only. I also dont want multiple menu blocks, so my question is this: Is there a way to make it so certain links wont appear uness you are in a certain group?
The best thing you can do is create a block in PHP
and add the following code for the links:
global $user_info;
if ($user_info['is_guest'])
echo '<a href="your link url">Link text</a><br>';
elseif (in_array(#, $user_info['groups']))
echo '<a href="your link url">Link text</a><br>';
else
echo '<a href="your link url">Link text</a><br>';
What the above code will do is create a SINGLE link which will check the users status and accordingly display a link - so basically for each link you will have to use the same code several times......
Explanation
1st code block--> If the user is a guest display this link
2nd code block--> If the user belongs to usergroup number # (replace # with the desired membergroup) then display this link
3rd block code--> If the user is not a guest but belongs to any other membergroup then display this link
-----------------------------------------------------
Be sure to replace the "your link url" text with your desired URL
And also "Text Link" with the link text you want displayed
Hope that will help you :)
Right now there is no way to do it like that.
But even if you make up diffrent blocks to show for diffrent membergroups, you are the only one seeing them all, and you can always collapse the ones you dont want to show even for you.
Ah brilliant suggestion by G6
Forget the coded way - thats long and hard
Easiest is like she said - create seperate blocks for membergroups and set their permissions for them ONLY
That way each membergroup will get an 'exclusive' menu :D
Great thinking G6 :D
the problem with multiple menu blocks was as soon as i created a second one it was just a mirror of the first because the menu manager doesnt see that they are sperate....
Dont use the menu manager to create those blocks...create those blocks using the "block Settings" page (add left block if ur menu is on the left)
Just specify the links in them like so:
- Jojo clan secrets
- Attack plans
- Jojo Fans
(just some examples above lol)
and then when creating this block only select the membergroup u want this block visible to - that way when they login only they wil see it - to everyone else there wont be a block present there
Hope u understood?
Additional help
Just incase you dont know HTML here is how u can create a simple menu using HTML
<a href="http://yoursite.com/page.html">Your link Text</a><br>
The above code will generate a single link - just replace the URL for ur page url and the your link text with whatever caption u want.
Add multiple lines in a single HTML block to create the menu :)
-----------------------------
Hope that helps :)