Expression syntax help request

Discussion in '[bd] Widget Framework' started by kontrabass, Mar 5, 2014.

  1. kontrabass

    kontrabass New Member

    Hi! I'm looking for some help with the correct syntax to combine these two expressions (each of which works great by itself):

    Code:
    (!empty($forum) AND in_array($forum['parent_node_id'], array(245,44,247,248)))
    OR (!empty($category) AND in_array($category['node_id'], array(245,44,247,248)))
    
    and...

    Code:
    XenForo_Template_Helper_Core::helperIsMemberOf($visitor, 6) == false
    
    So the end result, we want the widget displayed only in the nodes and categories listed, and only if the user is not in usergroup 6. :D

    Thanks!
     
  2. kontrabass

    kontrabass New Member

    Holy cow I think I got it!!

    Code:
    (!XenForo_Template_Helper_Core::helperIsMemberOf($visitor, 6)) AND
    ((!empty($forum) AND in_array($forum['parent_node_id'], array(245,44,247,248)))
    OR (!empty($category) AND in_array($category['node_id'], array(245,44,247,248))))
     
  3. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    So yes, you can put each of them in parentheses and link them with "AND" or "OR" depending on your required relationship :D Congrats on figuring it out by yourself!
     
Loading...