How to put bbPress reply form in a popup?

I'm trying to create a way to show the bbPress reply form in a popup when a user clicks on the "reply" link of the post they would like to reply to. Through some research, I believe this can be done with the use of the [bbp-reply-form] shortcode along with a lightbox or popup plugin however I don't how to to make it so that it gets the topic id/reply id first so it knows what the user is replying to. Any guidance would be greatly appreciated!

  • Milan

    Hello Alayna ,

    Hope you are doing well. :slight_smile:

    Unfortunately this shortcode is not taking any parameter to address specific reply. Please see this screenshot and refer this documentation. https://codex.bbpress.org/features/shortcodes/

    So I think would not be possible according to me to address some specific reply in popup content. And to make that shortcode take reply id would take some custom amount of work which is out of scope for support person here. So I suggest you to hire good developer for your this requirement or just user our Job Portal instead.

    Cheers,
    Milan

  • Alayna

    Thank you, Milan. I figured this was a bit out of reach but thank you for clarifying. I'm trying to make some compromise and I figured I would just try to toggle the reply form so it appears only once the user clicks "reply".

    By going into content-single-topic.php (copying into my child theme) and editing it to move <?php bbp_get_template_part( 'form', 'reply' ); ?> right below <?php bbp_get_template_part( 'content', 'single-topic-lead' ); ?> I made it so that the reply form displays beneath the lead topic, which is great. However, how can I make it so that the reply form isn't on display by default and only shows up once the "reply" button is clicked?

    Any help on this? Thanks in advance. :slight_smile:

  • Alayna

    I've been working on this all day but I can't seem to make it work. Here's what I've done so far:

    I wrapped the reply form into a div like so:
    <div id="replyform" style="display: none;"><?php bbp_get_template_part( 'form', 'reply' ); ?>

    I added a link into bbp-meta that looks like:
    <a href="#" id="replybox">Test Reply</a>

    And I added this into my child theme's function.php file:

    add_action( 'wp_footer', 'show_reply_form');
    function show_reply_form() {
    <script type="text/javascript">
       $(function() {
           $('#replybox').click(function() {
               $('#replyform').show();
                    $('#replyform').toggle();
               return false;
           });
       });
    </script>
    }

    But nothing seems to be happening. Any help would be greatly appreciated.

  • Predrag Dubajic

    Hi Alayna,

    Can you try changing all the dollar signs in your functions.php part of code with jQuery and see if it works after that.

    add_action( 'wp_footer', 'show_reply_form');
    function show_reply_form() {
    <script type="text/javascript">
       jQuery(function() {
           jQuery('#replybox').click(function() {
               jQuery('#replyform').show();
                    jQuery('#replyform').toggle();
               return false;
           });
       });
    </script>
    }

    Let us know how it goes.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.