Forum Replies Created
-
In reply to: Function to return all replies to a topic
Yes I did I noticed that before I tried the code. I will play around and see if I can find the problem, if the
get_page_by_title()
works as I would like then it must be an error somewhere else.Thank you for your help!
In reply to: Function to return all replies to a topicHi Robin, thank you for the example code! I have tried it and it seems to return the same value regardless of the title, so I am unsure…
Here is the sample code that I have used the function within:
function return_content_replies() { $title = $_POST['title']; $topic_id = rew_find_topic_id($title); if ( $topic_id == 'empty' ) { // create the topic here } else { $args = array( 'post_parent' => $topic_id, // ID of the topic 'order' => 'ASC', // Order of the replies (ASC or DESC) ); $replies_array = array(); if ( bbp_has_replies( $args ) ) { while ( bbp_replies() ) { bbp_the_reply(); $replies_array[] = array( 'id' => bbp_get_reply_id(), 'content' => bbp_get_reply_content(), 'date' => bbp_get_reply_post_date(), ); } } $response = array( 'status' => 'success', 'message' => $topic_id); } wp_send_json($response); }
In reply to: Function to return all replies to a topicYes, I it is guaranteed that the topic title is unique – I am the only one who creates the topics.
I am trying to link my site with an app, and I have implemented a search bar so when the user searches a topic, then all the replies to that topic will show.
I have everything working except returning the replies!
… The array of topic IDs sounds like it would work, how would i do that?
In reply to: Function to return all replies to a topicOkay I understand thank you.
So is there no way in returning the topicID when I just have the title?
In reply to: Function to return all replies to a topicFollow up from this question, is there a function which you pass the title of a topic “ABC” and it returns back the id of said topic i.e 123?
In reply to: Function to return all replies to a topicThank you!