Developer question: content filter

Hello πŸ‘‹

I am having a hard time understanding how to see if a user has R or X selected in code. I found how the database call is done, but can't find anything in code (programmatically) where it specifically checks for individual ratings.

A simple snippet of code would be great. If I already have $iCF as the profile content rating integer, and 4 and 5 are R and X, how do I check against this value? I can't even find any code to give me a example. 😁

Thank you!

  • 208
  • More
Replies (5)
    • Hello ο»Ώ@Wiseο»Ώ !

      This part is checked in 2 places:

      1. For the item lists with BxBaseModGeneralSearchResult::addConditionsForCf method.
      2. During the separate item's view with BxBaseModGeneralPageEntry::_isVisiblePage
      • Yes, I found them, but neither help me. I need an example of something like

        if ($cf == 4) then

        Where I can check if it is included in that users cfw_value. I'm not understanding the logic here, I'm having a glitch lol.

        Basically I want to display something only if R is included as one of their values in cfw_value. So I need to understand the logic.

        if ($iCF == 1 << (4 - 1)) then
        

        Doesn't work 😞. These bit operators are messing with my head. Lol

        Please help with that code, thank you @LeonidS πŸ™

        • Seeing that code, I think I understand my mistake, ugh! This should work

          if( $iCF & (1 << 3) ) {
            // do something
          }
          

          Going to go check now. Sometimes my brain gets stuck!

          • Did I say I hate bitwise operations πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

            • Yup, I figured it out.πŸ˜πŸ‘

              I'll leave this topic for anyone trying to figure this stuff out.

              I'm rusty. 😜

              Login or Join to comment.