Skip to:

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5176 closed enhancement (fixed)

Add get_content() to bp message threads

Reported by: trishasalas Owned by: johnjamesjacoby
Milestone: 2.0 Priority: normal
Severity: normal Version:
Component: Appearance - Template Pack Keywords: reporter-feedback has-patch needs-testing
Cc: trisha@…


In trying to implement the messages template layout from the new templatepack I'm running into problems with the fact that there is only an excerpt available. I have tried using the single template part on the page with the thread loop and an running into problems there as well. I suspect it boils down to not knowing the core code well enough. I've played with different options, changed things up and moved them around but I keep running into a wall when it comes to having both the thread and the message listed together.

If creating the content for the thread will help let's give it a go...if not any direction/advice is appreciated.

Attachments (2)

5175.patch (1.7 KB) - added by trishasalas 8 years ago.
5176.02.patch (1009 bytes) - added by boonebgorges 8 years ago.

Download all attachments as: .zip

Change History (19)

#1 @imath
8 years ago

Hi @Trisha

I think you need a template tag to be created, or you can create one on the model of this gist :

I'm sorry, taking a pause at office and don't have my stuff to create and suggest a patch file

#2 @hnla
8 years ago

@trishsalas Meanwhile could you push up your template files with markup then we can see the structure even if we don't have functioning queries yet.

#3 @boonebgorges
8 years ago

I think the problem may be that the full message content is not actually included in the global.

trishasalas, if you could share an example of how you would like your loop(s) to look - even if, as hnla says, it's not working properly - it'd help make it clearer what it is you need.

#4 @boonebgorges
8 years ago

  • Keywords reporter-feedback added

#5 @trishasalas
8 years ago

Sorry everyone, I just talked to @karmatosed and I wasn't getting these trac messages...just github stuff. I'll create the html for the template, push to github and post here.

I think the problem may be that the full message content is not actually included in the global.

Yeah, that about nails it @boonegorges. I created what I thought was a content function and it returned null (blank).

#6 @trishasalas
8 years ago

  • Cc trisha@… added

#7 @hnla
8 years ago

@trish hang fast on this as I think I have a working implementation, need to test further though as it's rough but I'm able to run the thread loop and pull in the message content on same page, more than likely lots of other issues though to be ironed out, will report back when tested further.

#8 @trishasalas
8 years ago

@hnla, good news! I've done something similar, the gist @imath posted (thank you, @imath) was helpful in ironing out my own issue with the function I made. However, that's all I've been able to get past...switch statements still getting in the way of viewing on the same page in my implementation.

8 years ago

#9 @trishasalas
8 years ago

  • Keywords has-patch needs-testing added

Adding the patch for bp_message_thread_content() just in case we decide we need it. It might be nice to have even if it's not used here. This was my original intention but I was not using the proper filter. @imath's post helped me to see why mine wasn't working.

#10 @boonebgorges
8 years ago

I'm afraid I'm a bit confused about what is needed here. I need the following info:

  1. Which template loop is this intended to work inside of? bp_has_message_threads() or bp_thread_has_messages()? I'm assuming the former?
  1. What is the function supposed to do? Can you explain with reference to this wireframe? Return the text "Integer..."?

#11 @trishasalas
8 years ago

@boonegorges, this is for bp_has_message_threads()

This will (hopefully) be the far right column message content.

The idea is to click the date and have the thread expand within the screen you see.

I'm not sure what loop @hnla used to get both the message threads and the message on the same screen. I wasn't having any luck with bp_thread_has_messages() but I was also distracted by the switch statement and what role it might be playing.

#12 @boonebgorges
8 years ago

  • Keywords needs-patch removed
  • Milestone changed from Awaiting Review to 1.9

5176.02.patch is a cleaned up version of trishasalas's original patch (which has what appears to be an accidental deletion in it).

I think this is close to what you want. However, it's worth noting the specific way that the last_message_* stuff is calculated, both in the _excerpt() function and this new function. Consider the following exchange:

Boone to Trisha: Hi
Trisha to Boone: Yo
Boone to Trisha: Cool

a) When viewing your Inbox, the last_message is the most recent message in that thread of which you are *not* the author. So bp_get_message_thread_content() returns 'Yo' when I am viewing my own inbox.
b) When viewing your Sentbox, last_message is the most recent message in that thread of which you *are* the member. bp_get_message_thread_content() returns 'Cool' when I'm viewing my Sentbox.

I can see how this makes sense in a way, but in any case, I want to make sure that everyone understands it and agrees that this is how the new message templates are supposed to work.

#13 @hnla
8 years ago

I'm getting a little confused here.

I asked that we hang fast as I was unclear on what exactly the issue was here without a working skeleton to see, thus I had to run up my own testcase to try and puzzle what was required to effect the wireframe view.

As far as I could see the main issue revolved around the primary switch statements and that the existing loops were probably not an issue.

I have now pushed up a working testcase branch to GH - This works to run the message thread loop left column while to the right I default to showing the compose screen (at this point with dummy text ) on initial top level messages. On selecting a thread from the messages-thread loop on the left we bring in that message and related ones to the right.

Now I do emphasize that I may well have missed some salient points and in effect there are issues ( I note some in dummy text for compose screen)- but I needed to blitz through this somewhat and even to this stage took a few hours - we needed to get a working model up and in place as this is a tricky little aspect of template pack to get right and this allows us to work with something, to modify and adjust. Too all intent and purpose the thread loop markup and single view markup is as we'll more or less proceed with albeit with tidy ups and minor adjustments and classes where required.

I also admit I haven't time to fully digest Boone's amendments and what Trish is trying to achieve and those may well be issues that indeed haven't really caught my attention yet as I'm not clear on what these address, but guessing as earlier that these do need addressing.

If possible think it might be better if this kind of discussion continue on the ticket on template pack GH so we can keep things in one place?.

#14 @boonebgorges
8 years ago

  • Milestone changed from 1.9 to 2.0

This ticket was mentioned in IRC in #buddypress-dev by paulgibbs. View the logs.

8 years ago

#16 @johnjamesjacoby
8 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 8070:

Messages: Introduce template functions for getting and outputting the last message in a single thread when in the inbox/sentbox loop. Props boonebgorges. Fixes #5176.

#17 @boonebgorges
8 years ago

In 8274:

Add trishasalas to 2.0 credits screen (missing props for r8070; see #5176)

Note: See TracTickets for help on using tickets.