Private Message Thread – Reply-Box on Top
-
Hello,
I changed the message-order in my message threads from Ascending to Descending. Now the newest messages are visible at first. But now I still have the reply-composing box at the bottom. How can I get that on top?
My code of the “buddypress/bp-messages/classes/class-bp-messages-thread.php” is visible here:
http://pastebin.com/QFF9n1WiIt would be really awesome if someone knows the answer.
Greetings,
Marvin
-
You shouldn’t change core files.
You should be able to make your changes via template overloads.
Copy this file
bp-templates\bp-legacy\buddypress\members\single\messages\single.php
to your child theme so that the dir structure looks like this:
your-theme\buddypress\members\single\messages\single.php
Then in single.php, change
if ( bp_thread_has_messages() ) :
to<?php $args = array( 'order' => 'DESC' ); if ( bp_thread_has_messages( $args ) ) : ?>
To change the location of the reply box, adjust the html in that same template overload.
Thanks for your answer and the hints.
Now the messages show in the desired order, but I get the following frontend-error: “There was a problem sending that reply. Please try again.”.
What could I´ve done wrong?
Here is my code in a pastebin:
http://pastebin.com/5SCRxju3The reply form has hidden fields that require variables only available within the
bp_thread_has_messages
conditional.Aaah, I see. Not it works perfectly. Thank you very much 🙂
Building on this idea (which is awesome!), is there a way to have the new message post below the ‘reply-composing box’?
With this setup, new messages are posting above the ‘reply-composing box’ until the page is reloaded. I’ve tried altering the single.php to accomplish this, but it seems a function might be controlling this layout?
Thanks @shanebp and @marvin_klempert!
anyone know if the code mentioned here: https://buddypress.org/support/topic/option-to-sort-inbox-msgs-new-to-old/#post-244547
is similar, worse, better ?
I need this functionality, but don’t trust random github code, and don’t know enough to understand that or the code above yet.
- The topic ‘Private Message Thread – Reply-Box on Top’ is closed to new replies.