Forum Replies Created
-
In reply to: Post count functions broken
Repairing the counter via Tools menu did the trick. Thank you for your help.
In reply to: Post count functions brokenHi Pascal,
Yes, I passed in the user id for admin and I’ve always got “0” back and admin had created many topics already.bbp_get_user_post_count(1, false);
Thanks.
In reply to: Reply Walker output to JSON formatI registered a new rest endpoint and wrote functions to retrieve all the replies with the code below. Although the code works, I’m not really happy with it because I’m not able utilize built in filtering (i.e. paged, order, posts_per_page… etc). This code is not optimize because it has no pagination and will retrieve all replies at once (can be bad if there are thousands of records).
function ldp_get_topic_replies( $data ) { $topicID = $data['id']; // Get an array of all replies belonging to a specific topic $repliesID = bbp_get_all_child_ids($topicID, bbp_get_reply_post_type()); $response = array(); foreach ($repliesID as $replyID) { $response[] = ldp_get_topic_reply($replyID); } return $response; } function ldp_get_topic_reply( $replyID ) { $reply = array( 'author_name' => bbp_get_reply_author_display_name($replyID), 'author_email' => bbp_get_reply_author_email($replyID), 'author_url' => bbp_get_reply_author_url($replyID), 'author_avatar' => get_avatar_url(bbp_get_reply_author_id($replyID)), 'link' => bbp_get_reply_url($replyID), 'reply_to' => bbp_get_reply_to( $replyID ) == 0 ? NULL : bbp_get_reply_to( $replyID ), 'topic_title' => bbp_get_reply_topic_title($replyID), 'meta' => bbp_get_reply($replyID), ); return $reply; }
In reply to: Reply Walker output to JSON formatHi Pascal, thanks the these links. However those addressed the problem seen in WP REST Api version 1 and version 2 is the refactor code for WP REST API which will eventually go into WordPress Core. Version 2 is what I’m using and it doesn’t work as explain in those blog.
In reply to: Reply date format based on ISO 8601I’m not allow to change bbp_get_reply() but I was able to work around my problem by calling
get_post_time('c', false, $replyID, false)
where ‘c’ is iso 8601 format.In reply to: Get replies ID of a given topicThis is superb. Thanks Pascal.
In reply to: Count topics with specific tagWith a combination of two methods, I was able to get the number of topics per tag. These methods query the taxonomies of bbPress’ topic-tag:
$tagList = get_the_terms($post->ID, bbp_get_topic_tag_tax_id());
The output of $tagList is as follow and ‘count’ is what i’m interested in:
{
term_id: 24
name: “Presidential”
slug: “presidential”
term_group: 0
term_taxonomy_id: 24
taxonomy: “topic-tag”
description: “”
parent: 0
count: 3
object_id: 155
filter: “raw”
}Hope this helps others.
In reply to: Count topic’s favoritesActually, there’s a function for this already and it’s called: bbp_get_topic_favoriters($postID).
Hope this helps others looking for something similar.
-Loc
In reply to: Query topics with WP REST APIMy post stripped the bracket in my endpoints, it should be the following instead:
http://localhost:8888/wp-json/wp/v2/topic?filter[forum_type]=sports http://localhost:8888/wp-json/wp/v2/topic?filter[forum]=sports
In reply to: Is there a REST API?I’m also looking for the REST API for bbPress but unable to find info on it either.
In reply to: Allowing inline images uploads in posts?Thanks everyone for posting your method of inserting inline images. So are those methods which you’ve posted a hack? Will it expose security risk? Why don’t bbPress support this capability as the thread has been asked over 3 years ago?