Now let's add the moderator part. Let's simplify by making the above into 1 condition, so:
PHP Code:
if ( !(canedit) ) {error}
Now let's add the moderator with an OR statement:
PHP Code:
if ( !(canedit) OR !(moderator) ) {error}
Possible combinations:
1. Can NOT edit, is NOT moderator, this will give:
PHP Code:
if ( TRUE OR TRUE) {error}
Error is shown, this is correct.
2. Can edit, is NOT moderator, this will give:
PHP Code:
if ( FALSE OR TRUE) {error}
Since you are using an OR statement only 1 of the conditions need to be TRUE. This is the case, so an error. This is not what you want.
3. Can NOT edit, is moderator, this will give:
PHP Code:
if ( TRUE OR FALSE) {error}
Since you are using an OR statement only 1 of the conditions need to be TRUE. This is the case, so an error. This is not what you want.
Now let's see the same with an AND:
PHP Code:
if ( !(canedit) AND !(moderator) ) {error}
1. Can NOT edit, is NOT moderator, this will give:
PHP Code:
if ( TRUE AND TRUE) {error}
Error is shown, this is correct.
2. Can edit, is NOT moderator, this will give:
PHP Code:
if ( FALSE AND TRUE) {error}
Since you are using an AND statement, both of the conditions need to be TRUE. This is NOT the case, so NO error. This is what you want.
3. Can NOT edit, is moderator, this will give:
PHP Code:
if ( TRUE AND FALSE) {error}
Since you are using an AND statement, both of the conditions need to be TRUE. This is NOT the case, so NO error. This is what you want.
Quote:
Originally Posted by sabret00the
so basically i want if either of clause_one or clause_two = true then let the person edit the post, else show a no permission screen.
|
This is not what you are doing: You are showing an error if either of them is true