Menu bar on 2 rows ?

Started by duck1, December 05, 2006, 12:21:09 PM

Previous topic - Next topic

Kays

Thanks, Neorics . Maybe it should been more explicit.

It's hard to tell what's happening witthout seeing the code you're using. What you're trying to do is a bit funky to impliment.

To hide/show for certain groups like Amins, Mods and guests. It's basically as posted above. Place the condition before the echo for that tab. And that tab will or won't show as required.


if($context['user']['is_admin'] || $context['user']['is_mod'])
   echo 'stuff admns and mods can see';

if($context['user']['is_guest'])
   echo 'stuff only guests can see';


Here's one way to break up menu bar into two lines. Create two divisions, one with the top row of buttoms, the second with the bottom row. Then selectivly remove the </div><div> when one row is needed Something like this:


echo '
   <div>'';
   The code for the first row of buttons

if(!$context['user']['is_admin'] && !$context['user']['is_guest'])
   echo '</div><div>;

  The code for the second row of buttons

echo '
    </div>';




If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

jossanaijr

What I'm trying to learn, understand and do is:

if ($context['user']['is_admin'])
     "do nothing" <- HERE is my problem; how to script this;

else ($context['user']['is_logged'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';

Because I need the action to all members except the administrator.

Kays

#22
if ($context['user']['is_logged'] && !$context['user']['is_admin'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Neorics

Quote from: Kays on December 29, 2007, 04:05:13 PM
if ($context['user']['is_logged'] && !$context['user']['is_admin'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';



correction, that should be if not else
[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

Bulakbol

Note: You can't hide anything from administrator/owner.

But if you only want logged-in members (and administrator of course) to see,

Quoteif ($context['user']['is_logged'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';

all the rest after that will be shown to guests.
----------------
$context['user']['is_admin']   - for admins eyes only
$context['user']['is_logged']  - for logged-in members and admins eyes only
$context['user']['is_guest'] - for guest and admins eyes only



Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Neorics

Quote from: JohnyB on December 29, 2007, 04:18:35 PM
Note: You can't hide anything from administrator/owner.

i believe it's possible but i cant prove it right now cause i'm tooooo sleepy

[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

Kays

Quote from: Neorics on December 29, 2007, 04:16:14 PM
Quote from: Kays on December 29, 2007, 04:05:13 PM
if ($context['user']['is_logged'] && !$context['user']['is_admin'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';



correction, that should be if not else

True, I wasn't paying attention.    ::)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Bulakbol

Quote from: Neorics on December 29, 2007, 04:34:29 PM
Quote from: JohnyB on December 29, 2007, 04:18:35 PM
Note: You can't hide anything from administrator/owner.

i believe it's possible but i cant prove it right now cause i'm tooooo sleepy



Everything is possible by modifying sources files. Yeah, but why should you hide something from admin/owner? Who should see it then?

Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Neorics

Quote from: JohnyB on December 29, 2007, 05:27:03 PM
Quote from: Neorics on December 29, 2007, 04:34:29 PM
Quote from: JohnyB on December 29, 2007, 04:18:35 PM
Note: You can't hide anything from administrator/owner.

i believe it's possible but i cant prove it right now cause i'm tooooo sleepy



Everything is possible by modifying sources files. Yeah, but why should you hide something from admin/owner? Who should see it then?



well for me i had too many buttons so i had to hide buttons that as an admin is useless or i just wont be using it

it was the Contact Us and Set as Homepage buttons

[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

Bulakbol

So, how did you hide them from admin using $context?
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Neorics

Quote from: JohnyB on December 29, 2007, 05:32:59 PM
So, how did you hide them from admin using $context?

hmm i just checked my forum again and the buttons i just mentioned were still there... i guess i didnt make it work...

but one thing i know that wont let the admin see the button or anything is a false permission

something like

if($user['allow_arcade'] || $context['user']['is_guest'])


lol is there such thing as $user? lol i forgot what's before that allow code thingy

anyways i accidentally did that and the buttons didnt show up... but i'm guessing the button didnt show up to anyone else...
[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

Bulakbol

#31
I think the button didn't show up to anyone. 

We can hide something by checking the group_name or group_id but not the $context, I think. :)  Not too sure. :P
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

jossanaijr

Quote from: Kays on December 29, 2007, 04:05:13 PM
if ($context['user']['is_logged'] && !$context['user']['is_admin'])
      echo'<td class="maintab_' , $last , '">&nbsp;</td></tr></table>
         <table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;" >
         <tr><td class="maintab_' , $first , '">&nbsp;</td>';


Thank youuuuuuu.
Working as I want it.
[SOLVED]

BTW What does "&& !$" means?

Kays

Cool, glad you finally got it.

&& = and
|| = or
! = not

So what that is saying is "if the member is logged and not an admn"

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Neorics

[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

jossanaijr

Quote from: Kays on December 30, 2007, 08:17:05 AM
Cool, glad you finally got it.

&& = and
|| = or
! = not

So what that is saying is "if the member is logged and not an admn"
Thank you!

Advertisement: