Open groups: Let all members post in every group without joining
-
Hi folks,
I use BuddyPress as part of a company intranet. Our BuddyPress Groups are used as a quick way to find who works in a particular department or location.
For our purposes, it makes sense for any staff member to be able to use any groups’ activity stream and bbPress forums, without having to join that group. The only exceptions would be for hidden groups, such as our Management group; they should still be invisible to non-members.
I’ve already solved half the problem by creating a plugin that allows any member to participate in any group’s bbPress forum: Read forum topic.
The next challenge is to allow anyone to post on any group’s activity stream (i.e. Home page).
There are two parts:
Show the “What’s new?” form to non-members
To do this, we can modify the template for/groups/single/activity.php
.
If we change line 52 from:<?php if ( is_user_logged_in() && bp_group_is_member() ) : ?>
to:<?php if ( is_user_logged_in() ) : ?>
, the template will no longer check if the user is a member anymore, so the “What’s new?” form will show up for everyone.At this point, if a non-member tries to write an activity post, the following error message appears:
There was a problem posting your update. Please try again.
I’d guess the action of posting checks if the user has permission to do so. Since they don’t, the post fails.
Allow users to write activity posts without joining the group
This is where I’m stuck.
I’ve tried to use the translation file to track down the function that’s throwing the error. TheThere was a problem posting your update. Please try again.
line reference points tobp-templates/bp-legacy/buddypress-functions.php:950
(this is actually line 962 now). If I change the error message directly on that line, the change isn’t reflected on the page. That tells me the error is coming from somewhere else.I would love a bit of insight on which files are involved once the user clicks “Post”.
As always, I’ll report back with my full solution if I figure this out.Thanks for any help you can provide!
- You must be logged in to reply to this topic.