Respecting a Member's 'Does Not Display on Web' setting
When determining whether or not member content should be displayed from 3rd party location, you can use the 'DisplayFlags' value when determining if the member is set to 'do not display'.
You can reach this value by hitting the following member endpoint:
http://secure2.chambermaster.com/api/associations({associationId})/members({memberId})/details
The response would include a key value pair of 'DisplayFlags' like so:
{
...
"DisplayFlags": 64,
...
}
That value is actually what is called a bitwise value. It is a way to store multiple values, as one value. Here is one article that describes it:
http://nikohelle.net/2010/11/02/tip-use-bitwise-operators-to-store-multiple-values-in-one-value/
So these multiple values, as CM saves them, each have a binary representation. Here it is:
CM Value Name | Numerical Value |
---|---|
DO_NOT_DISPLAY | 1 |
NO_EXTERNAL_URL | 2 |
NO_CALENDAR | 4 |
DISABLE_LOGIN | 8 |
NO_ADVERTISING | 16 |
UNUSED | 32 |
SEARCH_RESULT_ICON | 64 |
DISABLE_MEMBER_PAGE | 128 |
SEARCH_RESULT_URL | 256 |
SEARCH_RESULT_DESC | 512 |
SEARCH_RESULT_BG | 1024 |
HIDE_SOCIAL_NETWORK | 2048 |
So in the case of the member with '64' for their DisplayFlags value, what that means based on the above is that the ONLY option they have checked is the 'SEARCH_RESULT_ICON' (which is has a value of 64).
If we were to say, check, 'DO_NOT_DISPLAY' for the member, their DisplayFlags value would then equal '65' (64 + 1) - DO_NOT_DISPLAY has a value of 1.
If we were to say, check, 'DO_NOT_DISPLAY' and 'DISABLE_LOGIN', their DisplayFlags value would then equal '73' (64 + 1 + 8). And so on.
So a quick way for the developer here to tell if DO_NOT_DISPLAY is turned on, is to use the bitwise operator on the value and compare it to 1 (which is the value of DO_NOT_DISPLAY), like so:
(displayFlags value from API) & (CM display value in chart above)
So in this case, it would look like this:
64 & 1
If you get a value of 0 back, then DO_NOT_DISPLAY is NOT checked (which is what you get in this case). Let's take another DisplayFlags value:
2891 & 1
If you get a 1 back (which you will here), then that means DO_NOT_DISPLAY IS checked.