Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allow / disallow option for adding posts as activity


  • kevinbrands
    Participant

    @kevinbrands

    Hello,

    We’re gonna work with BuddyPress and want to make some additions.

    For one, we want to make it possible to add several custom post types to the activities.

    Besides that, we want to build in an option to give the writer of a post the chance to really add this to activities, or that this should not be visible as activity.

    Is there a hook to use for this? It should be a hook that runs just before the trigger that uses a post to make a new activity. I’ve searched for this, but I cannot find it..

    I hope someone can help me out, thanks in advance!
    -Kevin

Viewing 3 replies - 1 through 3 (of 3 total)

  • kevinbrands
    Participant

    @kevinbrands

    I’ve been working on this and made a little progress. But now I have the following problem:

    I used ‘bp_activity_before_save’ to get access to the activity object, so I’m able to set the ‘type’ to false and prevent the activity from being saved.

    I want to use a custom meta value to allow / disallow an activity from being saved. But when I use ‘bp_activity_before_save’, I cannot get the post meta values from the associated post.

    Is there a way / a hook or something that runs later than ‘bp_activity_before_save’, but still runs in time to stop the activity from being saved?


    imath
    Moderator

    @imath

    Hi @kevinbrands

    I suggest you to read this page of the documentation:

    Post Types Activities


    kevinbrands
    Participant

    @kevinbrands

    Thanks!

    I’ve found a way to fix this. I use the bp_activity_post_type_unpublish function to remove the activity after it is added, in combination with the save_post hook where the post meta I need is available.

    Topic can be closed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar