News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Menu Button Rights

Started by bogatto, September 02, 2005, 11:40:05 AM

Previous topic - Next topic

bogatto

OK newbie here,

I have added two buttons to the menu for some external page links, but they are accessible by anyone.  I would like to change this and add that only registered ppl for smf have access to them.  Bank.PHP and roster are the two buttons added

 
Quote<a href="hxxp:apostleslight.net/chat.php [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/chat.gif [nonactive]" alt="Home" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=help [nonactive]" target="_blank"><img src="hxxp:apostleslight.net/Themes/default/images/english/help.gif [nonactive]" alt="Help" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:www.apostleslight.net/bank/bank.php [nonactive]" target="_blank"><img src="/Themes/default/images/bank.gif" alt="Guild Bank" style="margin: 2px 0;" border="0" /></a>          
            <a href="hxxp:www.apostleslight.net/roster [nonactive]" target="_blank"><img src="/Themes/default/images/roster.gif" alt="Roster" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=search [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/search.gif [nonactive]" alt="Search" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=admin [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/admin.gif [nonactive]" alt="Admin" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=profile [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/profile.gif [nonactive]" alt="Edit Profile" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=calendar [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/calendar.gif [nonactive]" alt="Calendar" style="margin: 2px 0;" border="0" /></a>
            <a href="hxxp:apostleslight.net/index.php?action=logout;sesc=bbf769202091366e8819045cebae4ebc [nonactive]"><img src="hxxp:apostleslight.net/Themes/default/images/english/logout.gif [nonactive]" alt="Logout" style="margin: 2px 0;" border="0" /></a>
   

Thanks in advance for any info given.

Bog

Fizzy

Where have all the

if ($context

statements gone from index.template.php ?

"Reality is merely an illusion, albeit a very persistent one." - A.E.


1MileCrash

if ($context['user']['is_logged'])
      echo '
            <a href="roster url"><img src="path to image"></a>', $context['menu_separator'];
The only thing php can't do is tell you how much milk is left in the fridge.



bogatto

Outstanding, thanks folks.  I hade toyed around with the context stuff but kept crashing the site so just through it up above and seemed to work.  Obviously it didnt work cause i have nill knowledge of what I was doing.

Only thing now is the two buttons have a thick black back ground.  Any ideas?  They didnt before.

Bog

Fizzy

Which buttons are you referring to? They all look fine to me as a guest using Firefox
"Reality is merely an illusion, albeit a very persistent one." - A.E.


1MileCrash

Quotebut they are accessible by anyone.  I would like to change this and add that only registered ppl for smf have access to them.
The only thing php can't do is tell you how much milk is left in the fridge.



Fizzy

Yes well I had checked bank.gif and roster.gif and they both looked fine, no black border as I said before. Both graphics resolve with a white background! ???
So, the question is which buttons are we supposed to be looking at?
"Reality is merely an illusion, albeit a very persistent one." - A.E.


061

I think u forgot to put Border="0"

bogatto

Thank you the border to 0 fixed the issue.

Thanks much for the help

Baja

Hi there

Nice  8)

But how do I restrict the rights to view the button to one of my own custom-made groups

Regards and thanks in advance
Baja

1MileCrash

The only thing php can't do is tell you how much milk is left in the fridge.



Baja

Hi Tippmaster

Tanx for the answer

I added this code into my index.template.php:
// Display a button for members of the groups
$forum_leaderID = array(1, 9);
if(in_array($context['group']['id'], $forum_leaderID))
{
echo '
<a href="test.doc"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/memb_list.gif" alt="GC medlemsliste" style="margin: 2px 0;" border="0" /></a>', $context['menu_separator'];
}
But no button visible

for testing purposes I added:
else
{
echo '
<a href="http://www.hm-bar.dk/gcweb" target="_blank"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gcwebsite.gif" alt="Bes&oslash;g vores website" style="margin: 2px 0;" border="0"/></a>', $context['menu_separator'];
}
gcwebsite.gif is now visible to all groups - Group 1 and group 9 which should see memb_list.gif  :(

What am I doing wrong?

Regards

Baja

1MileCrash

i think i did something wrong.

try replacing

if(in_array($context['group']['id'], $forum_leaderID))

with

if(in_array($user_info['groups'], $forum_leaderID))
The only thing php can't do is tell you how much milk is left in the fridge.



Baja

Hi again Tippmaster

First I'd like to say Thanx for helping me here

My code is now (I added all group ID's into the array because I got same result as before)
$forum_leaderID = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
if(in_array($user_info['groups'], $forum_leaderID))
{
echo '
<a href="test.doc"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/memb_list.gif" alt="GC medlemsliste" style="margin: 2px 0;" border="0" /></a>', $context['menu_separator'];
}
else
{
echo '
<a href="http://www.hm-bar.dk/gcweb" target="_blank"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gcwebsite.gif" alt="Bes&oslash;g vores website" style="margin: 2px 0;" border="0"/></a>', $context['menu_separator'];
}
But even that didn't help  :'(

Regards Baja

Advertisement: