htmlphpbb

PHPBB <!-- IF something here OR something here -->


I am trying to do a simple if statement in PHPBB and I cannot figure out or find a solution to do an "or" in an if statement. I have found out how to find out if a member is a part of a certain group but now I need to find if the user belongs to either this group or that group.

I have tried

<!-- IF S_GROUP_ID == 12 || S_GROUP_ID == 5 -->

and I have tried

<!-- IF S_GROUP_ID == 12 or S_GROUP_ID == 5 -->

Am I missing something or can you not do an or in the IF statement...?


Solution

  • After trial / error I have found a solution

    on includes/functions.php I needed to add

    if ( !function_exists('group_memberships') )
        {
            include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
        }
        $groups = group_memberships(false,$user->data['user_id']);
        foreach ($groups as $grouprec)
        {
            $template->assign_vars(array(
            'S_GROUP_' . $grouprec['group_id'] => true
            ));
        }
    

    before

    //The following assigns all_common_variables that may be used at any point in a template.
    

    and on the .html template page I needed to do this:

    <!-- IF S_GROUP_12 || S_GROUP_5 -->
    ...
    <!-- ENDIF -->