Also I’ve tried
`status == “public”) {
some facebook sharing buttons
} ?>`
and that doesn’t work either.
With that, I just keep getting nothing outputted.
Logically bp_get_group_is_public() is the function you want to use —
That said, I can’t find anywhere in the core code where is_public is getting set, or getting used in the default theme. @djpaul – is this a set of functions that should be stripped out – they appear unused and not working.
Instead, the default template makes use of bp_get_group_type(), which in turn uses the $group->status attribute (as you’ve tried). In your case, are you sure you’ve setup your $group variable correctly?
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
My final code, usable for any who desire:
`
FACEBOOK SHARE CODE
`