Jump to content

OOP if or statement


Nodral

Recommended Posts

Hi Guys

 

I've absolutely no knowledge of OOP and I've inherited a huge site built with OOP.  I can convert some of it, to variables I understand and can use, and have a vague understanding of the predefined functions.  However I an struggling to put a simple if/or statement together.

 

if(user_has_role_assignment($USER->id,1)){

 

works fine, but when I try to do it as an if / or it fails.

 

if(user_has_role_assignment($USER->id,1)) || ($USER->id,36))  {

 

Any ideas?

 

Sorry, I don't have any errors as another part of the site turns off the error reporting and I can't for the life of me turn it back on with error_reporting(E_ALL) in the page;

Link to comment
Share on other sites

If-conditional statements work exactly the same in OOP as they do 'normally'.  You need to check the entire thing twice, like so:

 

if(user_has_role_assignment($USER->id, 1) || user_has_role_assignment($USER->id, 36))
{
   // do stuff
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.