Inline New Reply Form in Facebook style Single Page of Topics and Replies
-
Hello there…
I am trying to implement a view of Buddypress that looks like the Facebook newsfeed – a single page, which lists topics, each one having an add reply form underneath, and then a list of the existing replies. I have made the list of topics and replies, but I’m having trouble putting a working add reply form underneath each topic.
The loop structure I have used is:
$forum_ID_list = //a list of forum IDs foreach ($forum in $forum_list) // WP_Query to get the topic ID list foreach ($topic in $topic_ID_list) // output topic // output new reply form -BUT HOW...? WP_Query to get the reply ID list foreach ($reply in $reply_list) // WP_Query to get the reply details // Output the replydetails
So I am not using calls to bbpress() in the loop.
My question is: with this loop structure, how do I implement the output of the new reply form?
I have tried embedding the reply form as follows:
<form id="new-reply-XXX" name="new-post" method="post" action=""> <fieldset class="bbp-form"> <textarea class="bbp-the-content wp-editor-area" rows="3" cols="10" tabindex="101" name="bbp_reply_content" id="bbp_reply_content"></textarea> <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="TOPIC_ID" />' <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0" />'; <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply" /> <input type="hidden" name="_wpnonce" id="_wpnonce" value="99e426b2cf" />'; // NOT SURE WHAT THIS DOES AND IF I NEED TO CHANGE IT <input type="hidden" name="_wp_http_referer" value="" /> // CAN THIS JUST BE LEFT BLANK? <input type="hidden" id="bbp_redirect_to" name="redirect_to" value="MY_HOME_PAGE" /> <button type="submit" form="new-reply-XXX" tabindex="104" id="bbp_reply_submit" name="bbp_reply_submit" class="button submit">SEND</button>';
When I use this form, I am redirected to my home page, but the reply is not added to the topic.
So my questions are:
1. Can I do it by looping this way using WP_Query, and if so, can you answer my questions in upper case above about the form so it will add the topic correctly?
2. If I cannot used my WP_Query based loops, what other way can I loop and make the form work?
I’m using bbpress 2.5.8 with Buddypress 2.3.3 and WP 4.0.8
Thanks in anticipation! Antony.
- You must be logged in to reply to this topic.