XF 2.2 Two conditions to view content

Gunny

Member
Can a conditional statement be made to check both primary and secondary user groups to limit access to content

Code:
if( $user->isMemberOf($userGroupId) AND ( $user->isMemberOf($userGroupId)
 
Yes, conditional statements support logical operators.
  • OR / || - used to link alternative conditions
  • AND / && - used to link additional conditions
  • ! - place before a condition to invert it
  • XOR - returns true if only one of two conditions is true
 
Top Bottom