Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
In reply to: Synchronize creation Forum to a taxonomy forum
I have the plugin BBpress that allow me to create a forum on the admin panel on wordpress, the form is basic I just have to tape a name and pusblished it. Forum > Add new > tape the name > published and my forum is create. I also have a taxonomy forum that is linked to the user for that I do use the plugin User Taxonomy & Directory.
In reply to: Synchronize creation Forum to a taxonomy forumI did
add_action('bbp_new_forum_post_extras', 'my_custom_bbp_new_forum_handler'); function my_custom_bbp_new_forum_handler( $action = '' ) { error_log('test function'); if ( 'bbp-new-forum' !== $action ) { return; } if ( ! bbp_verify_nonce_request( 'bbp-new-forum' ) ) { bbp_add_error( 'bbp_new_forum_nonce', __( '<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); return; } do_action( 'bbp_new_forum_post_extras', $forum_id ); $forum_title = get_the_title($forum_id); $forum_slug = sanitize_title($forum_title); if (!term_exists($forum_title, 'forums')) { $result = wp_insert_term($forum_title, 'forums', array( 'name' => $forum_title, 'slug' => $forum_slug )); if (is_wp_error($result)) { error_log("Erreur lors de l'insertion du terme : " . $result->get_error_message()); } else { error_log("Terme de taxonomie 'forums' créé avec succès : " . print_r($result, true)); } } else { error_log("Le terme existe déjà : " . $forum_title); } $redirect_url = bbp_get_forum_permalink( $forum_id ); bbp_redirect( $redirect_url ); }
but it still doesn’t work the first error log doesn’t appear on the debug file
In reply to: PHP Deprecatedoh ok thanks
Viewing 3 replies - 1 through 3 (of 3 total)