Re: [Resolved] php conditionals based on group visibility/type?
they appear unused and not working.
right. One way they’re not working is that they don’t even report the right info. I don’t recall which it was, but I ran one of those functions, and it was printing Private in a public group.
I’m not sure what you mean “are you sure you’ve setup your $group variable correctly?”. In my thinking, BuddyPress sets it up, not me; I’m just trying to reference it. I copied that $group->status setup out of the definition for bp_get_group_type() in bp-groups-template.php.
I’ll give a whirl to the `bp_get_group_type()`, since that demonstrably at least produces the correct group visibility level; my trick will be to use its output in a conditional.
Ok, so `bp_group_type` is what prints text to the page, `bp_get_group_type` seems to summon the text as a returned value (which bp_group_type() uses for its printing)
SUCCESS!
`<?php if (bp_get_group_type()== "Public Group")
print “foo”
?>
<?php if (bp_get_group_type()== "Private Group")
print “bar”
?>`
On a private group, I saw foo outputted and no bar. So it works.
It feels less than elegant. It would be more elegant to just use the variables that bp_get_group_type() calls. But for now, it works.
Thanks, @RogerCoathup, for the guidance 