Eventually solved it:

In my app_controller:

function levelcheck()
        {
                $level_check = $this->othAuth->group('level');
                if (!empty($level_check))
                {
                        $level = $level_check;
                } else {
                        $level = 0;
                }
                return $level;
        }

Then I can call $this->levelcheck() when I need the users level.


Tane




On 5/29/07, Christopher E. Franklin, Sr.
<[EMAIL PROTECTED]> wrote:
>
> The best place to put this, I find, is in a copy of
> app_controller.php.  You place the copy into your app folder and add
> your beforeFilters() etc.  This way you don't have to write that
> function in every single controller.
>
> Throw this into it and see how it does for you:
>
> class AppController extends Controller {
>     //public $ext = ".php";
>     //public $helpers = array('Html', 'Javascript', 'Ajax');
>
> function beforeFilter()
> {
>                $level_check = $this->othAuth->group('level');
>                 if (!empty($level_check))
>                 {
>                         $this->level = $level_check;
>                 } else {
>                         $this->level = 0;
>                 }
>
> }
> }
>
> Now, everytime a controller tries to run a "filter"  this function is
> called, no matter what controller it is.  If you want to limit the
> controllers that call this, name it another function and you will have
> to call it manually from the controller that you want to use it.
>
> On May 29, 11:27 am, Walker Hamilton <[EMAIL PROTECTED]> wrote:
> > function beforeFilter()
> > {
> >                $level_check = $this->othAuth->group('level');
> >                 if (!empty($level_check))
> >                 {
> >                         $this->level = $level_check;
> >                 } else {
> >                         $this->level = 0;
> >                 }
> >
> > }
> >
> > then in your functions just grab $this->level when you need to.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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