I’m developing a plugin for a website, which uses the Group Extension API to create a new “subpage” in the group’s page, just like Home, Members…
Here’s the code:
class BP_Suggest extends BP_Group_Extension {
...
function display() {
global $bp;
$group_id = $bp->groups->current_group->id;
?>
<h2>
Suggest Ideas to the group.
</h2>
<?php $this->print_all_suggestions($group_id); ?>
<?php
}
...
I want to print, before the $this->print_all_suggestions($group_id);
function, a form for posting a suggestion – but to print this form only is the user is logged in and is a member of the current group (which I have the ID of, like you’ve seen in line 2 of the function display()
)
:
if(is_user_a_member_of_this_group()):
?>
<div>
....
</div>
<?php
else:
echo "You don't have permissions to post here";
endif;
What should the function is_user_a_member_of_this_group()
contain? (I’ll probably change the name, don’t worry 😉 )
Thanks!