Forum Replies Created
-
In reply to: 500: post_status no array
I find it just a little disconcerting that this problem has been in the wild – stopping, for example, new users of the plugin from being able to set anything up – for almost 6 months now …
In reply to: SDK/APIHi @fhasst1,
(Let me start by noting it could very well be that you already know this—but something in your post made me want to call it out just in case you weren’t aware.)
bbPress runs on top of WordPress. That’s important because it means if a user has logged into your (WordPress-driven) site/app then, by extension, they will have logged into the forum (insofar as bbPress will realize they are an authenticated user and will be able to identify them) … no need for a separate login.
Also, I think it’s worth calling out the fact that when it comes to adjusting the way bbPress behaves, or building some new forum feature, there is a really quite extensive set of functions, hooks and methods available to you that make it a really awesome platform to build on.
In reply to: Any approx date when 2.6 will be released?2.6 (beta 2) is available for testing (if you haven’t already seen the announcement post) – so things are happening!
In reply to: Search returns error 50350x
type errors can cover a multitude of sins.Do you have access to the PHP or web server error logs, at all, and if so are you able to match up any notable entries that coincide with these errors?
In reply to: Allow users to block posts from other usersI don’t know of any existing solutions for this, but it’s a great idea!
In reply to: Where and how to add manually a userHey Ludovic,
Quoting a bbPress Codex entry on forum visibility and accessibility:
Private – Only logged in registered users with a forum role can see these forums
With that in mind, so long as the user is logged in and has been assigned to a forum role (ie, participant) – which can be set directly if required via the edit-user admin screen (ie
/wp-admin/user-edit.php?user_id=xyz
) – then they ought to be able to access the private forum.Does that help at all/am I misunderstanding?
In reply to: How to add Box shadown for bbpress input textara boxThe reason I asked is because many of the classes you used in your last post aren’t ones I see in the regular reply editor – so I wondered if you had some sort of customizations in place.
In reply to: Form to forumNotifications would normally be dispatched when the
bbp_new_topic
action fires.In this case, you’d either have to trigger that manually or else call
bbp_notify_forum_subscribers()
directly (or else craft a manual solution of your own).In reply to: How to add Box shadown for bbpress input textara boxShare a URL?
In reply to: How to add Box shadown for bbpress input textara boxOn the box-shadow front, you might find a specifier like:
#wp-bbp_topic_content-editor-container .wp-editor-area
Provides the specificity you need to apply a box shadow from a custom stylesheet (or custom CSS plugin).
In reply to: TagThat should be possible, yes.
There are a few ways you could go about this but the easiest is probably to make topic tags available to regular blog posts (that way, both can share the same taxonomy and you probably won’t need to worry about modifying the bbPress UI).
If you really need to, you could go a step further and a) remove ‘regular tags’ from blog posts and b) rename topic tags so they simply read as ‘tags’. This would result in you having one type of tag everywhere.
Bear in mind however that if you already have a bunch of existing topic and regular tags you would need to do some migration work unless you are prepared to lose one set.
In reply to: How can I relate a Topic to more than one Forum?The WP Codex is a great starting point for learning how to do things like register a custom taxonomy … it comes to mind you might also want to explore plugins like Posts 2 Posts (which would offer an alternative way to go about this task).
In reply to: How can I relate a Topic to more than one Forum?Though I think I understand the gist of what you’re trying to accomplish, I’m not completely clear about how you see the user experience shaking out. That said, a natural way to group like-things together is to use a taxonomy (think tags and categories).
In this case, that might mean creating a new taxonomy especially for this task or it might mean extending an existing taxonomy (such as ‘topic tags’, such that they also work with pages and any other relevant post types).
In reply to: New topicsSomething like this ought to do the trick:
function bbp_add_recent_activity_view() { bbp_register_view( 'active', 'Active topics', array( 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'meta_compare' => '>=', 'meta_value' => date_i18n( 'Y-m-d H:i:s', strtotime( '-1 day' ) ), 'max_num_pages' => 1, 'orderby' => 'meta_value_num', 'show_stickies' => false ) ); } add_action( 'bbp_register_views', 'bbp_add_recent_activity_view' );
With this in place you should then be able to access a list of ‘active’ topics at:
example.com/forums/view/active
In terms of where to add this sort of code, there are a few options. One would be to create a new PHP file (starting with a
<?php
opening tag) at:wp-content/mu-plugins/bbpress-tweaks.php
In reply to: How to add Box shadown for bbpress input textara boxJust to add to Robin’s note, the textarea’s box-shadow is set to none by
wp-includes/css/editor.css
(which uses the same selector as you were using), so getting more specific with your rule is a good way to go here.In reply to: Form to forumWell, if you’re building on my example code you could make a few changes in order to get the information flowing back to the success message:
# Find this line bbp_insert_topic( /* ... */ ); # Change it: let's catch the post ID $topic_id = bbp_insert_topic( /* ... */ ); # Find this line post_to_bbp_status( 'success' ); # Change it: let's pass the post ID instead of 'success' post_to_bbp_status( $topic_id ); # Find this condition if ( 'success' === post_to_bbp_status() ) # Change it: test to see if it contains a post ID if ( is_numeric( post_to_bbp_status() ) ) # Find the line return 'Thank you for your submission.'; # Change it: display the new topic's permalink return 'Check your post: ' . get_permalink( post_to_bbp_status() );
Note that these changes are untested, they don’t do any safety checks etc etc. However, I hope it gives you some ideas you can use to further develop your own solution 🙂
In reply to: Is there an API for bbPressSounds like a great idea to me!
In reply to: Form to forumI’m sure you could do that pretty easily.
If a call to
bbp_insert_topic()
is successful it returns the post ID of the newly created topic. You can in turn pass that toget_permalink()
which will provide you with the URL.In reply to: Import now Admin is AnonymousExcellent, happy to hear it helped 🙂
In reply to: Import now Admin is AnonymousForums, topics and replies live in the posts table (typically
wp_posts
but the prefix might be different in your case). Something like this may help:UPDATE wp_posts SET post_author = 1 WHERE post_author = 0 AND post_type IN ( 'reply', 'topic' )
Essentially it finds all replies and topics where the author ID is zero and updates them to be associated with some other user (I used user ID 1 in my example, obviously modify to suit).
In reply to: Form to forumThere is of course the
[bbp-topic-form]
shortcode that ships with bbPress itself … but if that’s unsuitable or if customizing it to meet your goals isn’t an option for any reason, then you could roll your own solution quite easily.Here is a (super simple) example of just that – it creates an extremely simple (single field!) form via the
[post_to_bbp]
shortcode and uses the submitted data to create a new forum topic. Of course, there is a great deal it doesn’t do that you’d probably want in place before using it in production, but it’s just an example after all 🙂In reply to: Is there an API for bbPressNo worries!
In reply to: Is there an API for bbPressAbsolutely – I’m also still exploring this new territory, nice to have an ‘excuse’ to do so 😉
In reply to: bbPress 2.6 Release Candidate 3This is great news!
Unfortunately I did pretty much hit a fatal error straight away (I reported it and added a patch here – hopefully that was the right place/course of action) though I believe that will only impact those who test this out in a site that was already running bbPress, vs a clean installation.
In reply to: Is there an API for bbPressAdditionally, as an example of how you can add pretty much anything you want to the JSON responses returned by the REST API:
function bbpress_rest_api_replies_extra_data( WP_REST_Response $response ) { if ( ! is_array( $response->data ) ) { return $response; } foreach ( $response->data as $key => $single_item ) { // Only modify replies if ( bbp_get_reply_post_type() !== $single_item['type'] ) { continue; } // Add the author's details using a custom format $author_id = get_post( $single_item['id'] )->post_author; $author = get_user_by( 'ID', $author_id ); $response->data[ $key ]['author'] = "{$author->display_name} <{$author->user_email}>"; } return $response; } add_filter( 'rest_request_after_callbacks', 'bbpress_rest_api_replies_extra_data' );
You could say this is a bit of a brute force hack and although when combined with my last snippet it successfully adds the author’s display name and email address to replies (not topics), it shouldn’t really be used for that purpose “as is”: it doesn’t escape the author details, you probably don’t want to expose their email addresses, plus it’s out of alignment with how author meta is returned for other post types … However, I felt it was worth sharing an example of how you can quite quickly add arbitrary fields to REST API output.