Re: Displaying full name in (almost) every view
Thanks for all your suggestions. I will definitely look into othAuth. -- Martin Schapendonk, [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Displaying full name in (almost) every view
If you will be using othAuth, you can just add something like this to your default view: Welcome, user('firstname')." ".$othAuth->user('lastname'); ?>! In this way, you only have to include that line of code once and it will be shown in all pages. Likewise, you can set your own customized menu per user level by adding something like this (again, in your default view): user('group_id'); $userid = $othAuth->user('id'); if ($group == 1) { echo "Admin"; // place set of admin menus here } elseif ($group == 2) { echo "Manager"; // place set of manager menus here } elseif ($group == 3) { echo "Designer"; // place set of designer menus here } elseif ($group == 4) { echo "Writer"; // place set of writer menus here } ?> Regards, Reine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Displaying full name in (almost) every view
I agree I think the best practice is to set pertinent Session variables at the time when they login. Otherwise, you are going to bog down with excessive SQL requests to get that information again and again for every view. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Displaying full name in (almost) every view
Why not, when the user logs in, store the full name in the session (along with any other details you need from the user such as their id, aro equivalent, group/role etc.) and then in your view/layout/element query the session and if there is a Name: display it? HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Displaying full name in (almost) every view
Hi all, I'm trying to get a feeling on "CakePHP best practices". I'd like to show each logged in user his/her full name on every page. So, there must be something like a User-model of the loggedin user available to every view, right? What would be the best way to accomplish this? I was thinking to add a beforeRender to the app_controller which makes the User-model available to every view. Would that be the best/right thing to do? Thanks, Martin -- Martin Schapendonk, [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---