Tuesday, June 30, 2009

Re: return true or false

like so?

if ($this->Profile->checkPublic ($profile_user_id))
{
// true
}
else
{
// false
}

On Mon, Jun 29, 2009 at 4:54 PM, Dave Maharaj ::
WidePixels.com<dave@widepixels.com> wrote:
> I have a function that checks if a users profile is public or private
>
> function checkPublicAccess ($profile_user_id)
>  {
>   // check if profile is public or private
>           //0 = private 1 = public
>           $params = array(
>      'conditions' => array('Profile.user_id' => $profile_user_id,
> 'Profile.public' => '1'),
>      'contain' => false,
>      'fields' => array('Profile.public'));
>
>           $q = $this->find('first', $params);
>
>           // profile is not public so you must be logged in
>           if (empty($q)) {
>               return false;
>     }
>  }
>
> My question is how do I in the controller use the 'false' return?
>
> if ($this->Profile->checkPublic ($profile_user_id) == false)?
>
>
> Thanks
>
> Dave
> >
>

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

No comments: