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!
-
-
·
LeonidS
- ·
Hello ο»Ώ@Wiseο»Ώ !
This part is checked in 2 places:
- For the item lists with BxBaseModGeneralSearchResult::addConditionsForCf method.
- During the separate item's view with BxBaseModGeneralPageEntry::_isVisiblePage
-
·
LeonidS
-
- · Wise
- ·
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 π
-
- · Wise
- ·
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!
-
- · Wise
- ·
Did I say I hate bitwise operations ππππ
-
- · Wise
- ·
Yup, I figured it out.ππ
I'll leave this topic for anyone trying to figure this stuff out.
I'm rusty. π