BuddyDev

Search

[Resolved] BuddyBlog delete action hook/filter

  • Participant
    Level: Master
    Posts: 279
    NikB on #47564

    Hi Brajesh

    I’m using bblpro_post_submission_prepared_data to implement various additional actions when a post is created or updated and it works very well, but is there a similar hook I can use when deleting a post with BuddyBlog?

    With many thanks in advance
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #47567

    Hi Nik,
    Thank you for the question.

    1. Please avoid using the filter ‘bblpro_post_submission_prepared_data’ if you are not changing the data which will be saved. The goal is to allow filtering content/

    There are better action hooks available if you want to do some housekeeping action ( prefer ‘bblpro_post_submitted’.

    We haven’t added an action for deletion but you can use the default WordPress one( if trashing is enabled, ‘wp_trash_post’ or ‘wp_delete_post’)

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #47571

    Hi Brajesh

    Thank you for getting back to me.

    I wonder if it’s possible I may have used the wrong terminology ie. I’m using ‘bblpro_post_submission_prepared_data’ to add (or update) some additional postmeta entries (based on a single entry in the BuddyBlog form), which are required by the Events Manager plugin eg. the plugin requires an entry for both ‘_event_start’ and ‘_event_start_local’.

    This seems to work quite well but should I be using ‘bblpro_post_submitted’ instead?

    The other issue I have is that when deleting a post with BuddyBlog Pro, it doesn’t automatically update the wp_em_events table which is why I was looking for an action related to this but hopefully one of those you’ve mentioned will do the trick.

    Regards
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #47603

    Hi Nik,
    The code will work for both the hooks. it is the intention of the hook.
    I put the prepared data hook to allow customizing the prepared data which will be saved by the BuddyBlog Pro.
    If you are handing the saving of data, the bblpro_post_submitted is semantically suited for this.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #47607

    Hi Brajesh

    Thank you for your reply.

    May I ask, what’s the difference between bblpro_post_submitted and bbl_pro_post_updated?

    My biggest problem at this stage is that, as you may be aware, the Events Manager plugin stores some additional data in its own separate wp_em_events table. Everything seems to work fine (and an entry is automatically created in the wp_em_events) when a post is first submitted, and even when it’s approved but NOT when a post is updated (eg. if I change the dates with BBLPro, they don’t get changed in the wp_em_events table… and when I delete a post, it doesn’t get marked as deleted in the wp_em_events table either.

    I do appreciate this is outside of the scope of your plugin, I’m just trying to capture the correct hooks so that I can (hopefully) update the wp_em_events table “manually” when necessary.

    Regards
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #47647

    Hi Nik,
    Thank you for the reply.

    1. The hook ‘bblpro_post_submitted’ is called when the post is finally submitted( for public or review)
    3. the hook ‘bbl_pro_post_updated’ is called all the other times you are submitting post. It could be an update to draft post or already published post.

    I understand the sync issue. The Events plugin is not aware of BuddyBlog Pro and vice versa and that’s why it is happening.

    I hope you are able to find a solution.

    Regards
    Brajesh

The topic ‘ [Resolved] BuddyBlog delete action hook/filter’ is closed to new replies.

This topic is: resolved