Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to create dynamic reply-box

  • @jon-fergus

    Participant

    I assume this is pretty standard, but on our forum site (http://nexus.universaltheosophy.com/), the bbpress “reply box” is located at the bottom of any given Topic post. So, when someone wants to reply, they need to scroll all the way down. Also, directly beneath each existing reply is a “reply button”. If someone wants to reply to an existing reply, they click this button…. but what happens is that the Topic post reloads in their browser and then they’re taken to the bottom of the Topic where the reply-box resides.

    What we want, is this: when someone clicks reply, a reply-box appears directly beneath the existing reply they’re replying to (basically, how reddit works). I’ve seen at least one site that has managed to do this with some kind of customizing of bbpress, but nobody seems to want to share.

    In order to see how the reply button on our site currently works, you can use our dummy-test-account to login (just please be respectful and don’t make me delete too much spam) UN: [redacted] PW: [redacted] And use this discussion to see how the reply function currently operates: http://nexus.universaltheosophy.com/groups/key-concepts-study-group/forum/topic/reincarnation/

    Any help at all would be hugely appreciated. The current functionality really makes for a poor forum experience for our members.

    Also, we’re currently running bbpress 2.5.10 and WordPress 4.6.1.

Viewing 25 replies - 1 through 25 (of 45 total)
  • @jon-fergus

    Participant

    Moderators… why redact the only possible way for people to see the functionality I’m asking about? I posted this discussion on the buddypress site and the mods there told me it was stupid to post a link to our site when only members can see the reply-form. I also posted this same question a week ago here and it was simply deleted with no explanation. So I post here again with a way for people to see the functionality on our site and it gets redacted. How am I supposed to get any help with this question?

    @robkk

    Moderator

    I personally do not need login info, because I think I know exactly what you are talking about. I am not sure who redacted your info, but know that it was to protect your site from untrusted users.

    What you are looking for is already part of bbPress, its just that the js code that it uses doesn’t quite work for all browsers, and only in IE.

    To fix the issue, you can create or copy the existing reply.js file in a folder called js that should be in the root of your child theme that consists of the new code that is in a trac ticket that fixes this issue.

    This guide will help with what you would need to do with the js file.

    Basically you create a folder called js in your child theme. And just place the new reply.js file.

    https://codex.bbpress.org/themes/theme-compatibility/

    Here is the code for the file. You can also just download the file.

    https://gist.github.com/robkk/e193a869a627f955b427440c13493fa6

    @jon-fergus

    Participant

    Thanks robkk, but I tried what you said and it seems to have had no impact. Functionality stayed the same. When members click the reply button, the page still reloads and auto-scrolls them to the reply-form. Tried it with three different users, on Chrome, Firefox and Edge. Any further ideas?

    @robkk

    Moderator

    Huh, this works for me on my end fine. Maybe it doesn’t work on all themes?

    I guess you can confirm that you did download the gist file I linked to and added that to your child themes js folder.

    If you have ever set up a localhost test server on your cpu like WAMP, you can try what I said above in a default theme to see if there is another possible issue.

    @jon-fergus

    Participant

    Hmm…. yeah, maybe it’s a theme issue. To verify: I copied the file into a js folder at the root of my child theme. It seemed to make no change at all.
    I’ll set up a staging copy of the site and see if I can get it to work with a different theme.

    @jon-fergus

    Participant

    Something I noticed just now. I went to install a new plugin to help with migrating my database to a staging area, and the plugin install aborted with the error “Nothing found for Wp Admin Admin Ajax Php”. After I deleted the reply.js file from the js folder in my child theme, the plugin installed fine. I don’t know if this helps clarify why the reply.js wasn’t working, but I’m guessing it’s related.

    @jon-fergus

    Participant

    Ok, so I played around a lot with my site: changing the theme, disabling plugins, etc. etc. and nothing made any difference. So I went to my staging subdomain, stripped everything down to a basic wordpress install; created a child theme linked to twentysixteen; uploaded your reply.js file; then installed bbpress; added a single topic, and went to that topic to test the reply. The reply functioned exactly as it does on our site: i.e. click “reply” and the page reloads, and the user is brought to the reply-form.

    I don’t know what else to think of this. The reply.js file you gave just doesn’t seem to change anything. Any ideas what’s going on? Did I put it in the wrong place or something? Do I need to add something somewhere else to make sure that js is activated ???

    I’m at a loss for what to do here.

    @netweb

    Keymaster

    Maybe try going back a step or two further…

    Start with WordPress, add bbPress, does it work?

    From there then incrementally add your customisations.

    @jon-fergus

    Participant

    Hi Stephen. That’s what I did. On my staging site, I started with wordpress, added bbpress, setup a child theme linked to twentysixteen with no customizations, added the reply.js file, and it didn’t work.
    I know without logging in you can’t see the reply functionality, but this is my staging subdomain. You can see it’s just a completely base wordpress install with bbpress and nothing else added. And the reply.js file makes no difference in functionality. http://staging.universaltheosophy.com/forums/topic/test-topic/

    @jon-fergus

    Participant

    Created a second subdomain, right from scratch, added wordpress, added bbpress, added a child theme, uploaded the reply.js file to a js folder at the root of the child theme. Did no other customizations whatsoever. Same functionality as before.

    http://staging-nexus.universaltheosophy.com/forums/topic/test-topic/

    @netweb

    Keymaster

    What I mean was to do this step by step, don’t try to do everything at once.

    Install WordPress and bbPress and don’t do anything else.

    Now is it working?

    @jon-fergus

    Participant

    Stephen. I did exactly what you just said. Installed wordpress, bbpress, clean fresh installs, no other customizing of any kind, twentysixteen theme, and the reply button refreshes the page and takes the user to the reply-form. Add a twentysixteen child theme with the reply.js file in a js folder and nothing changes.

    @jon-fergus

    Participant

    Can either of you show me a site where the reply button functions the way I want? i.e. when you click reply the page doesn’t reload, but instead the reply-form accordions into place directly below the reply being replied to?

    Do either of you have a test site where this reply.js file is functioning that way?

    @robkk

    Moderator

    Yeah sure test it out on this site that I will probably delete later.

    Using terrible free hosting because I am cheap and don’t want to link to my actual live dev environment.

    username – testuser2016
    pass – duckduckduckduckgoose

    Reply to this topic. Login through the meta widget.

    http://yoshi-test.byethost22.com/forums/topic/bbpress-forum-sticky-topic/

    @jon-fergus

    Participant

    Yeah, that’s what I want. But I’m completely lost now. No idea why this doesn’t work for me.

    Are you sure there’s nothing else I need to do? Just copy the reply.js file into a folder called js under my child theme? And that’s it? I can’t understand why it wouldn’t work even when I created a brand-new subdomain, and did no other modifications: just installed wordpress, added bbpress, created bare child theme and added reply.js. What else could be interfering with this function!?

    I tried also simply using twentysixteen theme and adding reply.js to the existing js folder (in case there was some issue with using a child theme) and this didn’t work either.

    Here’s my bare test site: http://staging-nexus.universaltheosophy.com/forums/topic/test-topic/

    Try logging in:

    [mod note: aaand it’s gone.]

    @jon-fergus

    Participant

    Spent 3 more hours trying to figure this out. No luck. I’m just not knowledgeable enough.

    If you have any ideas of what might be going wrong, please let me know. Otherwise I’ll need to hire a developer to have a look (and if you know of who I can hire, or are for hire yourselves, please let me know).

    @robkk

    Moderator

    Just changed my site to a twenty sixteen child theme, still see no problem.

    Yeah, that’s what I want. But I’m completely lost now. No idea why this doesn’t work for me.

    Are you sure there’s nothing else I need to do? Just copy the reply.js file into a folder called js under my child theme? And that’s it? I can’t understand why it wouldn’t work even when I created a brand-new subdomain, and did no other modifications: just installed wordpress, added bbpress, created bare child theme and added reply.js. What else could be interfering with this function!?

    Yeah that’s it. I am lost how you are getting issues for this still. There shouldn’t be an issue with this and default themes.

    Only issue I have ever come across regarding issues with threaded replies is while using the Divi theme, some custom scripts in the theme has issues with it for some reason.

    I also tested a topic without a forum like what you have on your test site for the heck of it, and I still have not run into issues.

    Here is my custom twenty sixteen child theme that you can use and test yourself.

    https://cloudup.com/c-0XtmQvdjm

    @jon-fergus

    Participant

    Ok, progress (kind of). I uploaded your child theme and it works on my staging site. I was missing wp_enqueue_scripts in the functions.php file (duh me).
    But, still no luck on my main site. Something must still be interfering. I’ll use my staging site to test from the ground up, adding bit by bit until I find out what’s causing the issue. Will let you know if I figure it out.

    @jon-fergus

    Participant

    *edit: somehow deleted my previous comment*

    Ok. I found the problem: Buddypress.

    The functionality of reply.js works for bbpress, but does not work if the topic is in a forum that is within a Buddypress group.

    On my staging site I now have two topics: one within a buddypress group forum and one in a regular bbpress forum. The reply.js functionality works in the topic within the regular forum, but does not work in the topic that’s in the Buddypress group forum.

    If you’d like to see the functionality, here are the two topics (sign in credentials are in my previous comment above):

    http://staging-nexus.universaltheosophy.com/forums/topic/test-topic/

    http://staging-nexus.universaltheosophy.com/groups/test-group/forum/topic/test-group-topic/

    Now………. to find a solution. Any ideas would be much appreciated. I’ve also brought this to the Buddypress support forum. Will link to that below.

    @jon-fergus

    Participant

    @robkk

    Moderator

    Ok. I found the problem: Buddypress.

    The functionality of reply.js works for bbpress, but does not work if the topic is in a forum that is within a Buddypress group.

    Just tested on your site, as well as my test site. And yes that BuddyPress is related to this issue.

    May not specifically be BuddyPress and their code. I think there are tickets with bbPress’ BuddyPress extend code that might have issues with some conditionals in a bbPress post that is in a group.

    Will look through bbPress trac for some possibly related tickets.

    Edit: Found the ticket.

    https://bbpress.trac.wordpress.org/ticket/2974

    It is pretty easy to workaround this issue as well, since all you have to do is enqueue the javascript with a different conditional or enqueue it sitewide, but doing it sitewide might cause another issue somewhere.

    Will do some testing and get back.

    @jon-fergus

    Participant

    thank you so much Robkk! I’ll be so thankful if you’re able to find a solution/workaround. I’ll put some time into it also, but am afraid I’m not knowledgeable enough to get to the solution.

    @robkk

    Moderator

    Here I just added a bbpress-functions.php file to a twentysixteen child theme. I edited out the conditional causing the issues with groups. You can test this on my test site as well.

    You would have to remove the file later if the trac tickets patch I linked to is committed and you are using version 2.6 of bbPress, so that you can have the file enqueued on the pages where it is needed.

    https://cloudup.com/czqFBqJE8TE

    I think this will do it for you.

    After you are done testing I will start nuking my test site.

    @jon-fergus

    Participant

    You’re a life-saver!! Works on my staging site and now it’s working on my main site also!

    One other little thing though. I notice that the reply form appears below all sub-replies of a reply, instead of directly beneath the intended reply.

    For instance, here: http://staging-nexus.universaltheosophy.com/groups/test-group/forum/topic/test-group-topic/

    If you click on “reply” under reply #31, the reply form shows up beneath reply #32, instead of directly beneath reply #31.

    Do you know if there’s a work around for that also?

    @jon-fergus

    Participant

    Damn, another issue has come up. On my main site I’ve added the “Visual” tab to the reply form, using the following code in my functions.php file:

    /* add visual editor to bbpress replies */ 
    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['teeny'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    When the reply form is at its default location in a bbpress topic, the Visual tab works fine. But when the reply form pops up after clicking “reply” on a comment, the Visual tab fails to work (can’t type in it or see the contents). I reproduced the issue on my staging site for you to see:

    http://staging-nexus.universaltheosophy.com/groups/test-group/forum/topic/test-group-topic/

    I’m also using the “TinyMCE Advanced” plugin, but can verify that the issue with the Visual tab is independent of that plugin.

Viewing 25 replies - 1 through 25 (of 45 total)
  • You must be logged in to reply to this topic.