1

I am new to Buddypress. I am trying to figure out the following but there doesnt seem to be much help for the same (or I am not looking in the right direction).

I have created a 'meeting' as a custom post. I want to implement a functionality where I can include particular members in the meeting.

When I add this custom post, this should be visible as an activity update only to those users. Also, only those users should be able to view the post and if possible, update it.

I have already created bp-custom.php in which I have added support for Buddypress for meeting by:

add_post_type_support( 'meeting', 'buddypress-activity' );

I believe this will post to the user's activity stream by default. But what about the other users that I would select?

I know there exists an API bp_activity_add(). So, do I create a hook for 'save_post' and in the function, check if the post type is meeting, then I do a bp_activity_add() for all the users? But if I have already created the above (#1), wouldn't it repeat the update to the activity stream of the user who has created it?

1

There are more problems:

1) Add the activity on adding meeting

You could use the save_post hook to add activity, but I'd rather add custom notification, as the activity item can be easily missed. The how to is described in this great tutorial https://webdevstudios.com/2015/10/06/buddypress-adding-custom-notifications/

2) Let the users view the post

You should save post_meta with the array of user ID's, and than just compare with if (in_array(get_current_user_id(), $invited_users_ids)).

3) Let user edit the post

Depends if on frontend or in the admin? If on frontend, just create a custom template, check if the user is allowed to edit the post, and build a form for editing the post. If in admin, there are multiple ways to do this - using add_cap would be one, using pre_get_posts filter another

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.