Re: TIME SENSITIVE!!! — How to Prevent \”Auto Join\” for a Forum/Group
OK, as promised. Here’s how to make it work. Two steps.
1) You’ll have to patch your BuddyPress core files in the following way: https://trac.buddypress.org/attachment/ticket/2540/new_hooks_after_auto_group_join.patch. I’m hoping that the patch will go seamlessly into the core in the next version of BP (it’s less obtrusive than some of the less hackish fixes that Paul was probably thinking of above).
2) Put the following code in your bp-custom.php file: http://pastebin.com/NPSRxG3C.
In brief, here’s what happens: when a non-member posts to a group, he still joins the group (necessary in order to be able to post in the group forum). But the user is temporarily flagged as having been auto-joined, and immediately after the post goes through, the user is removed from the group. Also, a little cookie hack makes sure that the user doesn’t get a “You have successfully left the group” message after posting. Let me know if it works.