Hi godavid33,
You mentioned you purchased Pro, so can I ask you to post any future questions on these forums. You can post questions (as long as they relate to the free version), but the customer forums allow me to prioritise customers, and they get a more attention (I’ve been unusually active here in the last few days).
This is an interesting problem though :). And I’m not overly familiar with BuddyPress, but here’s an outline of what I’d do:
1. Register additional post status to include ‘invite only’ and ‘friends only’. Unfortunately WordPress’ UI won’t recognise these, so you’d either need to replace it, or you could use custom fields (but this is not as efficient), albeit slightly easier to implement.
2. Modify the SQL query (posts_request
hook is good for this) to include events of ‘friends_only’ if the organiser (post_author
column!) is a friend of the current user.
… or if the event ID is in a list of events the current user has been invited to.
Without digging into BuddyPress I can’t fill in the details of the how to retrieve the current user’s friends and/or invited events. But it should be fairly straightforward. Modifying the SQL query maybe tricky, so as mentioned you could use custom fields and add a meta_query at pre_get_posts
(as opposed to modifying SQL at posts_request
). But querying by metadata can be slow.
Depending on how much architecture you want to throw at the problem you could have a user-event table used for linking a user with the ‘invite only’ and ‘friends only’ events that they can see.
If you don’t register custom statuses, you should be sure to make ‘invite only’ and ‘friends only’ events private so they don’t show by default.