Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This just smells bad. :)
// We can use tablesort_sql now, but we don't need the ORDER BY part of the query.
// Because of that, we need to cut off the first 9 characters of the generated string.
$order_by = drupal_substr(tablesort_sql(_privatemsg_list_headers( FALSE, array('subject', 'recipient', 'last_updated'))), 9);
$fragments['order_by'][] = $order_by;
The documentation is ambiguous. I couldn't work out why we were generating an ORDER BY statement, then removing it. So we should clarify that we're literally removing the string 'ORDER BY' from the front of the returned value from tablesort_sql
. Then there's We can use tablesort_sql now, that's understandable from the point-of-view of someone reading a patch but means little to someone who's perusing privatemsg.module, trying to understand the code.
Some documentation of what the function is for, and returns, would help put this in context too.
Comment | File | Size | Author |
---|---|---|---|
#5 | privatemsg_order_better_doc.patch | 1.07 KB | Berdir |
Comments
Comment #1
Liam McDermott CreditAttribution: Liam McDermott commentedAhh, should have used the preview. Drupal stripped my
<quote>
tags out of there. This:Should be:
Comment #2
Liam McDermott CreditAttribution: Liam McDermott commentedThere's another instance of smelliness in
privatemsg_sql_list()
. :)Comment #3
BerdirIt is *BAD*. But... always the same question, how much effort do we want to put into our own query builder? Not more than improving the documentation imho.
In D7, it will work like that:
Which is *a lot* nicer than everything we can come up with D6.
I'm open for suggestions for the wording of the inline doc :)
Comment #4
NaheemSays CreditAttribution: NaheemSays commentedI am trying to get rid of list_sent in #303087: Move "Sent Messages" to privatemsg_filter, Add inbox, improve user filtering. so we may not want to pay too much attention to this problem here?
Ofcourse that still leaves the one in the list query.
Comment #5
BerdirLet's try with a better comment.
BTW:
This is how the code looks for Drupal 7, which is obviously *a lot* cleaner.
Comment #6
BerdirFixed in 6.x-1.x-dev.