Skip to:

bbp_new_forum hook

  • Laviic



    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 4 replies - 1 through 4 (of 4 total)

  • 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


    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.



    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!



    Hi… I am trying this. I want to auto-subscribe all users to new forums and I have tried the following:

    function ovni_subscribe_all_users_to_new_forum($forum_id){  // subscribe all users to a new forum
    	echo 'ovni_subscribe_all_users_to_new_forum fired';
    	// this function will fire on all wp-insert_posts - only act if is for a new forum
    	if ((get_post($forum_id)->post_type == bbp_get_forum_post_type()) && !wp_is_post_revision( $forum_id )){
    		// have just posted a new forum
    		$all_user_ids = get_users();
    		foreach ($all_user_ids as $user){
    			bbp_add_user_forum_subscription($user_id, $forum_id);
     add_action(save_post, ovni_subscribe_all_users_to_new_forum, 90,1);

    When I load the New Forum admin page, the echo trace statement appears at the top of the New Forum page, before it has been submitted.

    Can SKS help here please?

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