Forum Replies Created
-
In reply to: Is there an API for bbPress
What do you know, it worked!
So getting back to business – thanks for catching that error in my earlier snippet, Robin. I think yours is perfectly fine (also, great links re adding author meta) but just to ‘close the circle’ on my own snippet, here’s a revision:
function bbpress_enable_rest_api() { $types = array( bbp_get_reply_post_type(), bbp_get_forum_post_type(), bbp_get_topic_post_type(), ); foreach ( $types as $slug ) { $definition = (array) get_post_type_object( $slug ); $definition['show_in_rest'] = true; $definition['rest_controller_class'] = 'WP_REST_Posts_Controller'; register_post_type( $slug, $definition ); } } add_action( 'bbp_register_post_types', 'bbpress_enable_rest_api', 11 );
In reply to: Is there an API for bbPressMy replies seem to keep disappearing into the bbPress void … trying again just to see if this one will show up.
In reply to: Is there an API for bbPressApologies all and good catch, Robin!
I don’t think there’s anything wrong with your version of the code, but for the sake of alternatives here’s a fix for what I posted originally:
function bbpress_enable_rest_api() { $types = array( bbp_get_reply_post_type(), bbp_get_forum_post_type(), bbp_get_topic_post_type(), ); foreach ( $types as $slug ) { $definition = (array) get_post_type_object( $slug ); $definition['show_in_rest'] = true; $definition['rest_controller_class'] = 'WP_REST_Posts_Controller'; register_post_type( $slug, $definition ); } } add_action( 'bbp_register_post_types', 'bbpress_enable_rest_api', 11 );
Beyond that, the links you shared (in terms of mixing in extra info such as the author’s details) look solid to me 🙂
In reply to: Is there an API for bbPress…A PHP 5.2-friendly version that also covers the reply and forum post types:
function bbpress_enable_rest_api_support() { $enable_rest = array( 'show_in_rest' => true ); register_post_type( bbp_get_reply_post_type(), $enable_rest ); register_post_type( bbp_get_topic_post_type(), $enable_rest ); register_post_type( bbp_get_forum_post_type(), $enable_rest ); } add_action( 'bbp_register_post_types', 'bbpress_enable_rest_api_support', 11 );
In reply to: Is there an API for bbPressTo enable default REST API support for topics you could use a snippet like this one:
add_action( 'bbp_register_post_types', function() { register_post_type( bbp_get_topic_post_type(), [ 'show_in_rest' => true ] ); }, 11 );
This waits until bbPress has registered its post types, then modifies the properties of the topic post type so that it is exposed via the REST API. You could of course extend it to cover forum and reply posts, too. With that in place, you should find URLs like the following work as expected:
http://bbpress.site/wp-json/wp/v2/topic
In reply to: notification emails not sending – 2016Are you still logging email transactions, via Postman or by some other means? Have you uncovered any failures if so?
Who is your mail provider and have you approached them about this?
In reply to: Create new topic via emailOn the bbPress side, you’ll probably want to use bbp_insert_topic(). Usage is near-identical to wp_insert_post() – see here if you’re unfamiliar with this:
I’ll leave interaction with the Postmark API for you to figure out 😉
In reply to: Action to disable email subscription notificationsHowever, the onsite Buddypress notification stopped working as well. I guess Buddypress taps into the emails for notification generation.
That’s a shame.
I don’t actually find the same problem happens for me, though. If a new reply is posted, then subscribed users still receive a notification via their BuddyPress profiles. Are you describing some other type of notification, or is it possible some other customization/plugin etc is conflicting?
In reply to: Bbpress Background ImageAwesome, happy to hear it 🙂
In reply to: Bbpress Background ImageIf you want to take a custom CSS based approach, you could use the
body.bbpress
selector.In your case, an extra selector is needed for the main forum page. It’s not ideal to hardcode page IDs in CSS this way and normally that wouldn’t be required – but you seem to be using a custom page instead of a regular forum archive there.
Example:
body.page-id-174, body.bbpress { background: white url("http://replace.me/with-image.png") repeat top left !important; }
If you add the above to your child theme stylesheet it should get you in the right direction. Please also note if you are able to add it after the existing custom background CSS rule, you can drop the
!important
modifier.Of course, don’t forget to add a legit URL in there!
Hope that helps 🙂
In reply to: Action to disable email subscription notificationsWould this snippet work for you? You could add to a custom plugin, or to your theme’s functions.php file if that’s how you like to do things.
function bbpress_unhook_email_notifications() { remove_action( 'bbp_new_reply', 'bbp_notify_topic_subscribers', 11 ); remove_action( 'bbp_new_topic', 'bbp_notify_forum_subscribers', 11 ); } add_action( 'init', 'bbpress_unhook_email_notifications', 100 );