Mand
New Member
Posts: 24
inherit
247318
0
Dec 30, 2020 9:54:51 GMT -8
Mand
24
July 2017
mand
|
Post by Mand on Oct 2, 2019 3:29:29 GMT -8
One of my members would like PMs to display with the most recent at the top. Can I do this in CSS or would it need a plugin?
PS. And is it possible to make it an option selectable by each member? Not everyone's going to want it that way round.
|
|
inherit
76165
0
Jul 1, 2018 21:15:48 GMT -8
Beckea
Relax with a good book!
930
April 2006
purplescraps
|
Post by Beckea on Oct 2, 2019 6:58:38 GMT -8
One of my members would like PMs to display with the most recent at the top. Can I do this in CSS or would it need a plugin? PS. And is it possible to make it an option selectable by each member? Not everyone's going to want it that way round. I am tagging Scott to look at this. (Only admin name I know.)
|
|
Mand
New Member
Posts: 24
inherit
247318
0
Dec 30, 2020 9:54:51 GMT -8
Mand
24
July 2017
mand
|
Post by Mand on Oct 2, 2019 8:18:44 GMT -8
|
|
inherit
252032
0
Apr 4, 2024 21:43:14 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Oct 2, 2019 8:33:23 GMT -8
One of my members would like PMs to display with the most recent at the top. Can I do this in CSS or would it need a plugin? PS. And is it possible to make it an option selectable by each member? Not everyone's going to want it that way round. Hi Mand Changing the order in which things appear doesn't sound like something that would be possible with CSS. I think you'll need some JavaScript to do such things. And a plugin sounds like a convenient way to house it. That way you could set the permissions on the plugin to Custom, and add a new group to the permissions. Make that new group an 'Open' type with (no powers). That way, anyone who chooses can opt-in. Just to be clear, what this person wants is for the messages within each conversation to appear with the most recent at the top and the original message at the very end?If so, we can modify some code that bartlesby provided to flip the order of posts in a thread. The modified code would look something like this, although if we put this in a plugin rather than the Global Header, we could omit the <script></script> tags. <script> function flip() { var x = $("tr[id^='message-']"); var xlen = x.length; var z = x.parent(); while (xlen--) { z.append(x[xlen]); } }
$(function() { if (pb.data("route").name == "conversation") { flip(); pb.events.on("afterSearch", flip); } }); </script> EDIT: Sorry Mand, that script doesn't translate as directly as I originally had thought. Also, the original script only affects the order of the posts on a particular page, so the later posts appear on larger numbered pages (in threads that are long enough that pagination is necessary. That might be a bit confusing.
|
|
Mand
New Member
Posts: 24
inherit
247318
0
Dec 30, 2020 9:54:51 GMT -8
Mand
24
July 2017
mand
|
Post by Mand on Oct 2, 2019 10:26:01 GMT -8
Just to be clear, what this person wants is for the messages within each conversation to appear with the most recent at the top and the original message at the very end? That's how I understood it, yes, but I'll check with the member. Again, I'll check with the member in question. We're such a small forum that she may be the only one the question ever applies to. (We are only talking about PMs, by the way - just to be clear. Unless it is made an option in settings... I certainly don't want my own view of the forum to show posts "upside down"!)
|
|
#e61919
Support Staff
224482
0
1
Apr 24, 2024 16:47:46 GMT -8
Scott
23,285
August 2015
socalso
|
Post by Scott on Oct 2, 2019 11:51:25 GMT -8
Mand , I have a script that would work, but generally it's an everyone or no-one as it goes in the global header. However, if it's just one member and they are only using one theme, I can customize the script for a layout template and make it available only for that one member. Also, like Retread stated, it only reverses the order of the PM posts that have loaded on that page, not of the whole conversation. So really it would be difficult to follow the logical order of the conversation as the newest additions to the PM conversation will still be on the page of the last post (ie like page 2, or 3, etc. never on page 1 unless there is only one page in the conversation). Let me know if you are interested.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,779
January 2015
msg
|
Post by Lynx on Oct 2, 2019 14:18:36 GMT -8
Mand , I have a script that would work, but generally it's an everyone or no-one as it goes in the global header. However, if it's just one member and they are only using one theme, I can customize the script for a layout template and make it available only for that one member. Also, like Retread stated, it only reverses the order of the PM posts that have loaded on that page, not of the whole conversation. So really it would be difficult to follow the logical order of the conversation as the newest additions to the PM conversation will still be on the page of the last post (ie like page 2, or 3, etc. never on page 1 unless there is only one page in the conversation). Let me know if you are interested. You can modify your script, Scott, so it only affects the intended user: var userAffected = 10; // place user's ID here instead of 10 var currUser = pb.data('user').id;
if (currUser == 0 || currUser != userAffected) { // if current user is guest or the current user is not one we want to affect return; // exit }
// rest of script here
|
|
inherit
252032
0
Apr 4, 2024 21:43:14 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Oct 2, 2019 14:49:50 GMT -8
Scott and Lynx I discovered that bartlesby 's script actually did translate directly by changing post to message and thread to conversation. Where I made a rookie mistake was by not changing the name of the function and having both scripts running at the same time. Big collision, as one might expect. So the variant I made now looks like this: function flipmessages() { var x = $("tr[id^='message-']"); var xlen = x.length; var z = x.parent(); while (xlen--) { z.append(x[xlen]); } }
$(function() { if (pb.data("route").name == "conversation") { flipmessages(); pb.events.on("pageChange", flipmessages); } }); However, I don't know if that's as good the script Scott wrote. I put that in a plugin, which also contains instructions to create a new group and set the permissions for the plugin to include only that new group. That way the plugin will affect only those who opt-in. PMs Reverse Order.pbp (1.32 KB)
|
|