Nobody on this list is being paid to answer anyone's questions. We've
all been there before where our desperate queries have gone ignored.
Learn to live with it. In the meantime, maybe you should give this a
read:

http://catb.org/esr/faqs/smart-questions.html

But back to your problem, you're treating check() incorrectly. It
returns a boolean, not the value of the field. It returns true if the
param has been set. If you were to use AuthComponent, you could use
it's user() method like so"

if ($this->Auth->user('group_id') == 2)

On Fri, Aug 7, 2009 at 2:23 PM, FrederickD<[email protected]> wrote:
>
> I am in a quandary as to what is wrong with this code:
>
>                <div id="navbar">
>                        <ul>
>                        <?php if ($session->check('Auth.User.group_id') == 1): 
> ?>
>                                <li><?php echo $html->link(__
> ('distributors',true),''.'/'.'distributors'); ?></li>
>                                <li><?php echo 
> $html->link(__('dealers',true),''.'/'.'dealers'); ?
>></li>
>                                <li><?php echo 
> $html->link(__('groups',true),''.'/'.'groups'); ?></
> li>
>                                <li><?php echo 
> $html->link(__('users',true),''.'/'.'users'); ?></
> li>
>                        <?php elseif ($session->check('Auth.User.group_id') == 
> 2): ?>
>                                <li><?php echo $html->link(__
> ('distributors',true),''.'/'.'distributors'); ?></li>
>                        <?php elseif ($session->check('Auth.User.group_id') == 
> 3): ?>
>                                <li><?php echo 
> $html->link(__('dealers',true),''.'/'.'dealers'); ?
>></li>
>                        <?php endif;?>
>                        <?php if (!$session->check('Auth.User.id')): ?>
>                                <li><?php echo $html->link(__
> ('login',true),''.'/'.'users'.'/'.'login'); ?></li>
>                        <?php else: ?>
>                                <li><?php echo $html->link(__
> ('logout',true),''.'/'.'users'.'/'.'logout'); ?></li>
>                        <?php endif;?>
>                        </ul>
>
>        </div>
>
> The "If" construct at the bottom works to toggle the 'Login' and
> 'Logout' buttons. However, the "If" construct above based on
> 'Auth.User.group_id' always acts as if the value == '1'
>
> I have DebugKit installed and it shows the value of 2 for the person
> logged in through Session->Auth->User. The field 'group_id' is a
> foreign key in the Users table.
>
> Please help me out here! Thanks in advance.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to