Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbp_new_forum hook


  • Laviic
    Participant

    @laviic

    Hello,

    I am trying to write a plugin that adds some meta-information to a forum when it gets created. I can see that bbPress has a “bbp_new_forum” and a “bbp_edit_forum” hook, yet those never appear to fire, no matter what i do. I even added a php-die directly in front of their respective “do_action” calls inside the bbPress source code just to find out, that the part of the code that should call the new_forum hook appears to never actually be executed. What are those hooks for then, and what hooks DO get called when you create/edit a bbPress forum?

    Thank you for your help!

    My Version of WordPress is 3.8.1
    My Version of bbPress is 2.5.3

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

  • Laviic
    Participant

    @laviic

    By further digging around i noticed, that the hooks mentioned above indeed DO fire, but not when a new forum is created… They fire when a new TOPIC inside a forum is created.

    This is highly unintuitve. I suggest giving those hooks a more understandable name?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That doesn’t seem right. bbp_new_forum will only fire when forums are created outside of wp-admin, like in a BuddyPress Group Forum. If you want to add meta when any new forum is created, you’ll likely need to hook into WordPress’s wp_insert_post action, instead.


    Laviic
    Participant

    @laviic

    You are correct. The execution of the hooks when creating a new topic was a misobservation on my side. Sorry about that!

    The bbp_new_forum hook firing only when a forum is created outside wp-admin is interesting information. Thanks for clearing that up.

    I have already worked around the ‘missing’ hooks by tying into the save_post hook. Its not exactly what i would call elegant, and it requires some additional checks to make sure my callback was executed for the right event, but it does the job.

    So, the only thing that is left for me to ask is: Why isn’t there an intuitively named hook for when one creates a forum from the backend? Or is there one that i am missing? :)

    Thank you for your response!

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

You must be logged in to reply to this topic.